Issue with Plex Media Server redirection to /web using Traefik

Hello,

I would like to request assistance in resolving an issue with configuring a Plex server using Traefik as a reverse proxy. My current configuration seems to work correctly when accessing Plex via the URL mydomain.com/web. However, when I try to access it directly at mydomain.com, I receive an error. I’ve noticed in the logs that there are multiple “entrypoints” like /transcode so I don’t want to simply add a /web prefix to the Traefik service configuration, as I’m concerned it might negatively affect the transcoder through this domain.

Here is my current configuration:

  routers:
    plex:
      rule: "Host(`plex.xxx.xx`)"
      service: plex-service
      middlewares:
      - plex-middleware
      entryPoints:
      - https
      - httpsPublic

  services:
    plex-service:
      loadBalancer:
        servers:
          - url: "https://x-x-x-x.xxx.plex.direct:32400"

  middlewares:
    plex-middleware:
      headers:
        hostsProxyHeaders:
          - X-Forwarded-Host
          - X-Forwarded-For
        referrerPolicy: same-origin
        forceSTSHeader: true

Could someone please advise on how to optimize this configuration to work correctly with both / and /web?

Thank you for any assistance and suggestions.

  1. Don’t overthink this.
  • Using the Plex.direct (certificate bound) URL will always get you in trouble.
  • Use the LAN IP of the server. Let PMS handle the plex.direct URL

  • The certificate will change every 90 days.

  • It will also change every time you spin up a new container instance

  • Write the renaming rule:
    – If there is no endpoint or port (Plex clients always add the right info)
    – Redirect to https://LAN.IP.of.Server:32400/web

  1. Don’t worry about the internal endpoints (/transcode, etc) which PMS uses.
    – It you look carefully, these are either to 127.0.0.1 (Loopback) or the IP of the machine itself.

If you are a “Simple URL editor” , without attempting to get fancy, you’ll be better off.

Again, Don’t overthink / over complicate it.

I found real issue. Plex is returning 401 unauthenticated on entrypoint. My traefik was set to handle errors 400-599 and push it through errors middleware that couse issue and remove redirection header. Changing error handler to 500-599 solved issue and now / is redirecting me to /web. Works fine with plex.direct.

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