trakt / trakt/trakt-api

Plex Sync: the `{}` body on GET requests makes Plex drop the connection behind a reverse proxy, plays go missing

Open
#927 0 comments 0 reactions 1 assignee View on GitHub

@rectifyer is already working on this.

Since Sep 8, 2026.

Dominant language
TypeScript
Stars
359
Forks
20
Avg merge
2d 21h
Merged PRs (30d)
13

Description

Hi,

So the short version: the sync sends {} with Content-Length: 2 on every GET. When Plex sits behind a reverse proxy, it reads the headers, misses the body, answers anyway and then closes a connection that still has 600 KB of response in it.

The longer version. Plex reads a request only once. Behind a proxy (Caddy here, but anything built on Go's HTTP stack will do the same) the two body bytes arrive just after that read, because the proxy sends the headers first and the body a moment later. Plex sees a request without a body, answers it and closes the connection. The kernel finds unread bytes on that socket and turns the close into a reset. Any part of the response still waiting to be sent is thrown away. The small calls survive. The big one, /library/metadata with 100 ids, does not. The client retries three times, gives up and never gets to the history call. The next round starts from a later lastViewedAt, so those plays are skipped for good.

I confirmed this with packet captures and a kernel trace (tcp_send_reset, reason TCP_ABORT_ON_CLOSE), then reproduced it through a plain Caddy: four resets in eighteen batch calls. A direct https connection to Plex never lost a byte. So this only hits people with a proxy in front of Plex. They will not know why an episode is missing.

Suggested fix: send GET requests without a body. Plex does not read it. Now we know exactly how it does not read it.

I have a workaround in place (my proxy strips GET bodies), so no rush on my end. Captures and a reproducer script are available if you want them.

Cheers! Eric.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.