Skip to content

Add PLEX_PUBLIC_URL for Play Now and "Open in Plex" links when PLEX_URL isn't reachable from devices - #33

Open
claude-on-call wants to merge 1 commit into
ecwilsonaz:mainfrom
claude-on-call:feat/plex-public-url
Open

claude-on-call wants to merge 1 commit into
ecwilsonaz:mainfrom
claude-on-call:feat/plex-public-url

Conversation

@claude-on-call

Copy link
Copy Markdown

Problem

PLEX_URL is the address MediaSage uses to reach Plex. In Docker setups that's often an internal hostname (http://plex:32400) or a LAN IP. The same URL is also used in two places where other devices need to reach Plex:

  1. Play Now. plexapi's playMedia tells the player to fetch the play queue from PLEX_URL's host and port. A phone can't resolve plex, and can't reach a LAN IP when it's away from home.
  2. "Open in Plex" links are built as {PLEX_URL}/web/..., which a browser can't open for the same reason.

Change

A new optional PLEX_PUBLIC_URL: the Plex URL as seen from browsers and players (e.g. https://plex.example.com). When it's set:

  • play_queue passes its protocol, address and port to playMedia. plexapi merges **params into the command, so these override the defaults.
  • Playlist links use it instead of PLEX_URL.

When it's unset, nothing changes. It's documented in the README env table, .env.example and docker-compose.yml.

Testing

  • Two new tests: the play queue is sent with the public address, and playlist links use the public URL.
  • pytest: all tests pass.
  • On a live instance (PLEX_URL=http://plex:32400, Plex published behind a reverse proxy), Play Now to Plexamp on a phone works with PLEX_PUBLIC_URL set. (I didn't test whether Plexamp would also have found the server some other way without it.)

🤖 Generated with Claude Code

PLEX_URL is often Docker-internal (http://plex:32400) or a LAN IP. plexapi's
playMedia hands that host to the player, and playlist links are built from
it too, so phones away from home and browsers on other networks can't
follow them. PLEX_PUBLIC_URL, when set, overrides the address given to
players and the base of playlist links. Unset, nothing changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant