What is the problem?
When using nginx reverse proxy with a X-Script-Name header, the redirect to the login page works fine but then the web page requests that follow do not respect that header.
What did you already try to solve it?
Adding random other headers that shouldn't and didn't affect the problem.
Have you tried running in safe mode?
Yes
Did running in safe mode solve the problem?
No
Systeminfo Bundle
octoprint-systeminfo-20220513165258.zip (24.7 KB)
Additional information about your setup
OctoPrint Version 1.7.3
OctoPi Version 0.18.0, running on Raspberry Pi 3 Model B Rev 1.2
Prusa mk3s
Firmware: stock
browser: chrome
operating system: windows 10
nginx version: nginx/1.14.0 (Ubuntu)
Problem details ...
Nginx setup ...
location /prusa/ {
add_header X-Script-Name /prusa;
rewrite ^/prusa/(.*) /$1 break; #strip /prusa from url
proxy_pass http://192.168.1.205/;
}
I browse to http://mydomain/prusa
192.168.1.106 - - [13/May/2022:17:06:33 -0700]
"GET /prusa/ HTTP/1.1" 302 331 "-"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/101.0.4951.54 Safari/537.36"
It redirects to login correctly using the X-Script-Name
/prusa
192.168.1.106 - - [13/May/2022:17:06:33 -0700]
"GET /prusa/login/?redirect=%2F%3F
&permissions=STATUS%2CSETTINGS_READ HTTP/1.1"
200 1145 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/101.0.4951.54 Safari/537.36"
But then every request after that is ignoring X-Script-Name
. This is the first
192.168.1.106 - - [13/May/2022:17:06:33 -0700]
"GET /static/css/bootstrap.min.css HTTP/1.1"
404 209 "http://mydomain.com/prusa/login/
?redirect=%2F%3F&permissions=STATUS%2CSETTINGS_READ"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/101.0.4951.54 Safari/537.36"