PleX update broke my reverse proxy configuration
Hello!
I have a PleX server on my home pc and I have a vpn to my home to access it trough private ip.
As I have a lot of services running, I installed Nginx, created a url for it, and started mapping.
The problem is:
All of my urls are under one single domain name, i.e., i access media.mydomain.com, it gives me a home page for my internal links, and when i click one, it redirects to media.mydomain.com/plex, and after the last update, plex isn't working anymore! It gives me all white screen, no errors on error.log or access.log on nginx side.
The only error i found is in console from the browser, it gives me this:
This error does not occur when I access through media.mydomain.com:32400 or locally with 127.0.0.1:32400
This is the current plex configuration. If someone has a light on what could possibly be wrong. I already tried to move the files to another folder and ask plex to repair it self, but that did not work.
I have to access through a single link (can't add a plex.mydomain.com)
And pardon for my bad english
location /plex { rewrite /plex(/.*) $1 break; proxy_pass http://localhost:32400; proxy_http_version 1.1; proxy_set_header Accept-Encoding ""; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $http_host; proxy_cache_bypass $http_upgrade; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_redirect off; sub_filter '/web/' '/plex/web/'; sub_filter_types *; sub_filter_once off; }
UPDATE 1:
After some research, I found the issue! The issue was nginx altering js and css files with the sub_filter directive, and it was raising a flag for SRI (Subresource Integrity). The solution was to sub_filter only html files, not js and css. To do that, i alter thje sub_filter_types *; to sub_filter_types html;
The final configuration is this:
location /plex/ { rewrite /plex(/.*) $1 break; proxy_pass http://localhost:32400/web/; proxy_http_version 1.1; proxy_set_header Accept-Encoding ""; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $http_host; proxy_cache_bypass $http_upgrade; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_redirect off; sub_filter '/web/' '/plex/web/'; sub_filter_types html; sub_filter_once off; }
Hope that helps anyone out there!
Comments Section
Having the same problem (using almost identical NPM config as you) since the latest version. Rolling the server update back does resolve issue so seems something changed on Plex's backend with the new Web Version 4.136.1
Haven't found a solution yet for the current version but will be keeping an eye on this thread! If I find a workaround will post here as well. - Cheers!
Thanks! I'm trying various nginx configs but still haven't found a solution! Will post it here if I find one
Just to let you know, I found the solution! it is on the post already