Hosting in subdirectory only works with // at the end of the URL
Database management in a single PHP file
Brought to you by:
jakubvrana
Starting with 4.8.0 it seems that adminer does no longer work correctly, when it is hosted in (or mapped to) a subdirectory.
In our case we have adminer running in a docker container (official image). We use a Nginx location to map the app into our Site under https://www.example.com/dbmgr
location /dbmgr {
gzip off;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header X-Forwarded-Prefix "/dbmgr";
proxy_pass http://192.168.161.8:8200/;
}
We obseve the following behavior:
path=/dbmgr/.path=/dbmgr// (2 slashes!!)path=/dbmgr//
Sorry, the list is not correctly formatted and I can't edit the issue. Here it is again, opefully better:
No slash at the end (https://www.example.com/dbmgr)
The page loads, but CSS is not correct. It tries to load https://www.example.com/adminer.css?v=122850400 (missing the /dbmgr/ part).
There are cookies set with path=/dbmgr/.
Klick on login seems to load the page again and does nothing.
1 Slash at the end (https://www.example.com/dbmgr/)
CSS looks fine
The cookie path is now path=/dbmgr// (2 slashes!!)
Login still does not work
2 Slashes at the end (https://www.example.com/dbmgr//)
The cookie path still has 2 slashes: path=/dbmgr//
Everything works
Last edit: MikeH 2021-03-04
I'm not aware of any change that could have caused this. I'd suggest changing the location to
/dbmgr/.Thanks, that really fixed the problem.