Menu

#790 Hosting in subdirectory only works with // at the end of the URL

4.8.0
closed-works-for-me
nobody
None
5
2021-03-04
2021-03-04
MikeH
No

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:

  1. No slash at the end (https://www.example.com/dbmgr)
  2. The page loads, but CSS is not correct. It tries to load https://www.example.com/adminer.css?v=122850400 (missing the /dbmgr/ part)
  3. There are cookies set with path=/dbmgr/.
  4. Klick on login seems to load the page again and does nothing.
  5. 1 Slash at the end (https://www.example.com/dbmgr/)
  6. CSS looks fine
  7. The cookie path is now path=/dbmgr// (2 slashes!!)
  8. Login still does not work
  9. 2 Slashes at the end ((https://www.example.com/dbmgr/)
  10. The cookie path still has 2 slashes: path=/dbmgr//
  11. Everything works

Discussion

  • MikeH

    MikeH - 2021-03-04

    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
  • Jakub Vrána

    Jakub Vrána - 2021-03-04
    • status: open --> closed-works-for-me
     
  • Jakub Vrána

    Jakub Vrána - 2021-03-04

    I'm not aware of any change that could have caused this. I'd suggest changing the location to /dbmgr/.

     
  • MikeH

    MikeH - 2021-03-04

    Thanks, that really fixed the problem.

     

Log in to post a comment.

MongoDB Logo MongoDB