Plex behind Caddy redirects to Plex login

So I try to run Plex behind Caddy as a proxy.
Caddy and Plex both run in docker containers.

But when I browse to my Plex subdomain, I got redirect to the Plex login web page, where I just want to see my library without going to app.plex.com.

My Caddyfile for Plex:

plex.{$CADDY_DOMAIN} {

   errors stdout

   # Password protect everything
   basicauth / {$CADDY_USERNAME} {$CADDY_PASSWORD}

   proxy / plex:32400 {
      transparent
   }
}

My docker-compose.yml for Plex:

plex:
        image: linuxserver/plex
        container_name: plex
        environment:
            - VERSION=docker
        expose:
            - 32400
        restart: unless-stopped

Anybody knows how to fix this?

Hey @DenBeke,

In my experience, reverse proxying Plex is far more trouble than the benefits are worth. Honestly, I just use app.plex.com.

It looks like they’ve written their web app to issue redirects to their own site. You could try to use proxy header regex rewriting (see: https://github.com/mholt/caddy/pull/2144), which should be available in the latest Caddy release (although currently still undocumented), to alter the Location header it sends and force it to redirect to your own site. No promises that the locally hosted version served by the Plex instance itself even has a login path, though.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.