0

My currently Nginx config (below) will successfully take me to Plex Media Server's web interface when typing: https://plex.mydomain.com in a web browser address bar from anywhere.

However, immediately after displaying the web interface, the URL is automatically forwarded (persistently) to: https://plex.mydomain.com/web/index.html#!/

How can I use the rewrite directive to persistently display: https://plex.mydomain.com instead of https://plex.mydomain.com/web/index.html#!/ in my web browser's address bar?

    server {
            listen 443 ssl http2; 
            listen [::]:443 ssl http2;
            ssl_certificate     ./ssl/fullchain.cer;
            ssl_certificate_key ./ssl/cert.key;
            server_name  plex.mydomain.com;
            location / {
                proxy_pass http://localhost:32400;
                proxy_set_header Accept-Encoding "";
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection $http_connection;                }
    }

I tried adding the below line to the config above, but it didn't make any difference.

rewrite /web/index.html#!/(.*) /$1 break;

I also tried the below line; which didn't make any difference either:

rewrite /web/index.html/(.*) /$1 break;
MKANET
  • 573
  • 6
  • 27
  • 51
  • You can't. `#!/` is so-called _hash_ part of an URI, it is set from your page JS and you can't control it from the server side. That URI part is not send to web server at all when a browser makes HTTP request. – Ivan Shatsky Jun 09 '21 at 10:28
  • I figured that might be the case, that's why I specifically mentioned I also tried the rewrite: `rewrite /web/index.html/(.*) /$1 break;` – MKANET Jun 09 '21 at 14:11
  • I think you still don't understand what I mean. This hash that you see in the browser address bar is added by on-the-page JavaScript. User browser doesn't did any additional requests to the server (nginx). Therefore you can't control it server side. – Ivan Shatsky Jun 09 '21 at 15:55
  • I see. So I can't rewrite `/web/index.html` either? My last rewrite line tried to change `https://plex.mywebsite.com/web/index.html/#!/` to `https://plex.mywebsite.com/#!/` – MKANET Jun 09 '21 at 19:42

0 Answers0