RasPlex / OpenPHT

OpenPHT is a community driven fork of Plex Home Theater
Other
599 stars 109 forks source link

OpenPHT should give relative URLs to server #202

Closed gbooker closed 7 years ago

gbooker commented 7 years ago

OpenPHT: Present in master PMS: Irrelevant

As diagnosed from here: https://forums.plex.tv/discussion/252931/allowed-networks-issue-on-synology-dsm-5-2

If the user is running PMS behind a port forwarding mechanism, such as docker, then URLs handed to the server of the form http://127.0.0.1:32400/… may not be accurate. In the above forum topic, the user had a request of the form: GET /photo/:/transcode?height=2048&url=http%3a%2f%2f127.0.0.1%3a32500%2flibrary%2fmetadata%2f17711%2fart%2f1484090491&width=2048. The client sees PMS running on port 32500, but inside the docker container PMS is running on port 32400. As such when PMS attempts to fetch the photo at the specified URL, it fails since nothing is listening on port 32500 within the container.

We've determined the best resolution to this issue is to have clients use a relative URL in the url parameter. So the request would instead be GET /photo/:/transcode?height=2048&url=%2flibrary%2fmetadata%2f17711%2fart%2f1484090491&width=2048 (the http://127.0.0.1:32500 was removed).

It appears the relevant code is located here: https://github.com/RasPlex/OpenPHT/blob/cc7f0f18ffb33027bd72869e43279e250f528c85/plex/FileSystem/PlexAttributeParser.cpp#L151

This would also apply to the media transcoder as well.

Kwiboo commented 7 years ago

@gbooker thanks! Will include a fix in next release.

Kwiboo commented 7 years ago

A fix for this was included in the recently released v1.8.0.148-573b6d73