docker-traefik icon indicating copy to clipboard operation
docker-traefik copied to clipboard

Plex remote access "not available outside your network"

Open louisgarciasr opened this issue 5 years ago • 13 comments

Having a hell of time trying to figure out the plex remote access. I have traefik2 running using oauth and working great with sabnzbd, radarr, sonarr, portainer, organizer. For plex, I have set it to basic auth (not oauth). Plex works for me, but I cannot get it to be available outside my network. In Plex settings, I have set the following:

Plex Settings - Enabled remote access Manually specified public port: 32400 (I have also tried 443) Internet upload speed: 300 Custom access urls: MYSERVER:32400 Networks allowed without auth: 172.18.0.0/24

Plex docker-compose:

plexms: container_name: plexms restart: always image: plexinc/pms-docker volumes: - $DOCKERDIR/plex:/config - /data/transcode:/transcode - /data/staging:/staging - /data/remote:/media - $DOCKERDIR/shared:/shared networks: - t2_proxy security_opt: - no-new-privileges:true ports: - "32400:32400/tcp" - "3005:3005/tcp" - "8324:8324/tcp" - "32469:32469/tcp" - "1900:1900/udp" - "32410:32410/udp" - "32412:32412/udp" - "32413:32413/udp" - "32414:32414/udp" environment: - TZ=${TZ} - HOSTNAME="MovieReel" - PLEX_CLAIM="claim-opbxUxXKWiMzJbumneXz" - PLEX_UID=${PUID} - PLEX_GID=${PGID} - ADVERTISE_IP=$SERVER_IP:32400 labels: - "traefik.enable=true" ## HTTP Routers - "traefik.http.routers.plexms-rtr.entrypoints=https" - "traefik.http.routers.plexms-rtr.rule=HostHeader(plex.$DOMAINNAME)" - "traefik.http.routers.plexms-rtr.tls=true" ## Middlewares - "traefik.http.routers.plexms-rtr.middlewares=chain-no-auth@file" # No Authentication ## HTTP Services - "traefik.http.routers.plexms-rtr.service=plexms-svc" - "traefik.http.services.plexms-svc.loadbalancer.server.port=32400"

I've noticed while searching for a solution that this is a common problem. Unfortunately, I've not been able to get it resolved. Any guidance would be greatly appreciated.

Louis

louisgarciasr avatar Sep 08 '20 16:09 louisgarciasr

Can you access the plexms container by going to your host_ip:32400 ?

If yes, then you also need to port forward on your router 32400 to host_ip:32400

This is what fixed plex external for me.

1josh13 avatar Oct 25 '20 16:10 1josh13

shouldn't you use the no-auth for Plex?

- "traefik.http.routers.plexms-rtr.middlewares=chain-no-auth@file"

What did you set as your $SERVER_IP variable your host ip or something else?

shawnthompson avatar Dec 01 '20 23:12 shawnthompson

You need two custom access urls: http://<server_lan_ip>:32400/,https://<plex.yourdomainname>:443/

You can actually turn off Remote Access at this point.

If you have a PlexPass you can set Network -> LAN Networks as appropriate (probably just 192.168.0.0/16)

Probably should use no-auth middleware for Plex, as it'll be login-protected by your plex account. It's annoying to sign in with oauth, then with plex. Plus it makes it easier to share with whoever you want, they just need a plex account.

dphildebrandt avatar Dec 07 '20 16:12 dphildebrandt

You can actually turn off Remote Access at this point.

Just to clarify, will disabling Remote Access only allow access from the LAN and https://plex.yourdomainname.com? If for example you were on a 4G network or a friends Wi-Fi and logged into your account using the Plex app or https://app.plex.tv/desktop, it won't work without Remote Access enabled? Is that right?

robflate avatar Dec 07 '20 22:12 robflate

No, it will work without Remote Access enabled. Because you set a custom URL as https://plex.yourdomain.com when you sign in to Plex it will use that URL. As long as you have port forwarding 443 on your router, traefik will catch it and route it like usual.

I use it on cellular, lan; friends and family use it connected to their wifi etc.

dphildebrandt avatar Dec 08 '20 02:12 dphildebrandt

@dphildebrandt Thanks. I'm trying all that but I can't figure out why it's not working, I'm getting the UI but it's giving me the option to start a server.

Here's my compose file:

### Variables set in my .env
PLEX_PORT=32400
PLEX_WEB_TOOLS_PORT=33400
PUID=1000
PGID=134
TZ="America/Montreal"
SERVER_IP=xxx.xxx.xxx.xxx (Home ISP IP)

  # Plex - Media Server
  plexms:
    image: plexinc/pms-docker
    container_name: plexms
    restart: unless-stopped
    # network_mode: host
    networks:
      - t2_proxy
      # t2_proxy:
      #   ipv4_address: 192.168.90.230
    # devices:
    #   - /dev/dri:/dev/dri # for harware transcoding
    security_opt:
      - no-new-privileges:true
    ports:
      - "$PLEX_PORT:32400/tcp"
      - "3005:3005/tcp"
      - "8324:8324/tcp"
      - "32469:32469/tcp"
      - "1900:1900/udp" # conflicts with xTeVe
      - "32410:32410/udp"
      - "32412:32412/udp"
      - "32413:32413/udp"
      - "32414:32414/udp"
      - "$PLEX_WEB_TOOLS_PORT:33400"
    volumes:
      - $DOCKERDIR/plexms:/config
      - $DOWNLOADDIR:/Downloads
      - $VIDEODIR:/media
      # - /dev/shm:/transcode # Offload transcoding to RAM if you have enough RAM
      - $DOCKERDIR/plexms/plex_tmp:/transcode
    hostname: "plex.domain.com"
    environment:
      TZ: $TZ
      # PLEX_ClAIM: $PLEX_CLAIM
      PLEX_CLAIM_FILE: /run/secrets/plex_claim
      PLEX_UID: $PUID
      PLEX_GID: $PGID
      ADVERTISE_IP: https://$SERVER_IP:$PLEX_PORT/
      # ADVERTISE_IP: http://192.168.86.100:$PLEX_PORT/
      # ADVERTISE_IP: https://plex.domain.com:$PLEX_PORT/
      ALLOWED_NETWORKS: http://192.168.86.100:$PLEX_PORT/,https://plex.domain.com:443/
    secrets:
      - plex_claim
    labels:
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.plexms-rtr.entrypoints=https"
      - "traefik.http.routers.plexms-rtr.rule=Host(`plex.$DOMAINNAME`)"
      ## Middlewares
      - "traefik.http.routers.plexms-rtr.middlewares=chain-no-auth@file"
      ## HTTP Services
      - "traefik.http.routers.plexms-rtr.service=plexms-svc"
      - "traefik.http.services.plexms-svc.loadbalancer.server.port=32400"

  • 192.168.86.100 is the static IP of my server from my router.
  • plex.domain.com is actually changed to my DNS using CloudFlare
  • I've tried a lot of different variations of as you can see with my comments.
  • hardware transcoding wasn't working
  • ideally I would like to set a static IP for Plex so other containers can view it, like Sonaar.
  • port forwarding on router is enabled

I can connect to the Plex UI from Plex.domain.com, IP of my ISP and my internal IP but no server only the Plex TV.

shawnthompson avatar Dec 08 '20 13:12 shawnthompson

I'm getting the UI but it's giving me the option to start a server.

Is there no Sign In button in the top right of the Plex webui? Maybe there's a problem with your Plex claim token? You could try a new token or you could just SSH tunnel into Plex.

ssh -L 8080:localhost:32400 user@dockerhost e.g. ssh -L 8080:localhost:32400 [email protected]. Once done you can browse to localhost:8080/web/index.html and set up your server.

ideally I would like to set a static IP for Plex so other containers can view it, like Sonaar.

Plex will be on the t2_proxy network. Any other container on the t2_proxy network can communicate with plex via plex:32400. No need for a static IP on Plex.

robflate avatar Dec 08 '20 15:12 robflate

Thanks @robflate. I was signed in, I just couldn't see my server. I got it to work / setup by running docker compose in the plexus folder itself with network_mode: host variable, setting up a new server, shutting down the container, then running my main docker-composer with all the settings above. Now I see my server and I'm able to add to it. YAY

As for the static IP, I tried connecting to to my Plex from my Sonaar container but I couldn't without using a static IP.

I tried plex, plexms, plex.domain.com with and without ssl...

shawnthompson avatar Dec 08 '20 23:12 shawnthompson

Glad you got it working. You definitely have something wrong in your setup if you can't connect to Plex from another container in the same network, using in your case, plexms:32400. Specifically, in Sonarr > Settings > Connect > Plex, it should be;

Host: plexms
Port: 32400

If you docker network inspect t2_proxy, can you see Sonarr and Plex in the list?

Also, hardware transcoding works if you use;

devices:
      - /dev/dri:/dev/dri

and have a Plex Pass and an Intel processor with QuickSync.

robflate avatar Dec 09 '20 00:12 robflate

I'm running AMD on ubuntu, I'll looking into Video Core Next once I'm up and running.

As for my network, it worked now without a static IP!!!! Awesome. I swear I tried it before and it didn't work but maybe because I had the static IP set on Plex or maybe I spelt it wrong...

shawnthompson avatar Dec 09 '20 12:12 shawnthompson

here is my Plex config from the docker-compose-t2.yml

   # Plex - Media Server
  plexms:
    image: linuxserver/plex:latest
    container_name: plexms
    restart: unless-stopped
    depends_on:
      - traefik
    networks:
      - t2_proxy
    devices:
      - /dev/dri:/dev/dri # for harware transcoding
    security_opt:
      - no-new-privileges:true
    ports:
      - "$PLEX_PORT:32400/tcp"
      - "3005:3005/tcp" # controlling Plex Home Theater via Plex Companion
      - "8324:8324/tcp" # controlling Plex for Roku via Plex Companion
      - "32469:32469/tcp"
      - "1900:1900/udp" # access to the Plex DLNA Server
      - "32410:32410/udp" # GDM network discovery
      - "32412:32412/udp" # GDM network discovery
      - "32413:32413/udp" # GDM network discovery
      - "32414:32414/udp" # GDM network discovery
      - "$PLEX_WEB_TOOLS_PORT:33400" 
    volumes:
      - $DOCKERDIR/plexms:/config
      - /mnt/media/TV:/tv
      - /mnt/media/Movies:/movies
      - /dev/shm:/transcode # Offload transcoding to RAM if you have enough RAM
    environment:
      - TZ=$TZ
      - PLEX_CLAIM=lolnowaybruh
      - PUID=$PUID
      - PGID=$PGID
    labels:
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.plexms-rtr.entrypoints=https"
      - "traefik.http.routers.plexms-rtr.rule=Host(`plex.$DOMAINNAME`)"
      ## Middlewares
      - "traefik.http.routers.plexms-rtr.middlewares=chain-no-auth@file"
      ## HTTP Services
      - "traefik.http.routers.plexms-rtr.service=plexms-svc"
      - "traefik.http.services.plexms-svc.loadbalancer.server.port=$PLEX_PORT"

Also I should note that I also port forwarded port 32400 to my docker host IP.

1josh13 avatar Dec 18 '20 21:12 1josh13

No, it will work without Remote Access enabled. Because you set a custom URL as https://plex.yourdomain.com when you sign in to Plex it will use that URL. As long as you have port forwarding 443 on your router, traefik will catch it and route it like usual.

I use it on cellular, lan; friends and family use it connected to their wifi etc.

Hey, I have got this working with the above, it now works with app.plex.tv and locally on the LAN however whenever I go to https://plex.mydomain.com it flashes a 401 error then show the index.html page with the big plex logo but doesnt prompt for a login. Have you ever seen this before?

My Plex YML

  # Plex - Media Server
  plexms:
    image: plexinc/pms-docker:plexpass
    container_name: plexms
    restart: "unless-stopped"
    networks:
      - proxy_net
    runtime: nvidia
    security_opt:
      - no-new-privileges:true
    ports:
      - "32400:32400/tcp"
      - "32400:32400/udp"
      - "3005:3005/tcp"
      - "8324:8324/tcp"
      - "32469:32469/tcp"
      - "1900:1900/udp"
      - "32410:32410/udp"
      - "32412:32412/udp"
      - "32413:32413/udp"
      - "32414:32414/udp"
    volumes:
      - $MEDIADIR:/data
      - $PLEXDIR:/config
      - /dev/shm:/transcode # Offload transcoding to RAM
    environment:
      TZ: $TZ
      HOSTNAME: "JPH-ESX-DOCKER"
      PLEX_CLAIM_FILE: /run/secrets/plex_claim
      PLEX_UID: $PUID
      PLEX_GID: $PGID
      NVIDIA_VISIBLE_DEVICES: all
      NVIDIA_DRIVER_CAPABILITIES: compute,video,utility
      ALLOWED_NETWORKS: 10.0.10.0/24,10.0.20.0/24
      ADVERTISE_IP: "http://$SERVER_IP:32400/,https://plex.$DOMAINNAME:443/"
    secrets:  
      - plex_claim
    labels:
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.plexms-rtr.entrypoints=https"
      - "traefik.http.routers.plexms-rtr.rule=Host(`plex.$DOMAINNAME`)"
      ## Middlewares
      - "traefik.http.routers.plexms-rtr.middlewares=chain-no-auth@file"
      ## HTTP Services
      - "traefik.http.routers.plexms-rtr.service=plexms-svc"
      - "traefik.http.services.plexms-svc.loadbalancer.server.port=32400"

My cutom URLs in Plex are

http://10.0.10.40:32400/,https://plex.mydomain.com:443/

Remote access was enabled and mapped to specific port 443 but that didnt work and now remote access is disabled.

So I have no idea why I cant get in via the plex.domain.com but it works for all other access methods.

Any ideas?

sudo-kraken avatar May 05 '21 08:05 sudo-kraken

DONT TURN ON CLOUDFLARE ROCKET LOADER!! disabling this fixed it.

sudo-kraken avatar May 07 '21 14:05 sudo-kraken