pi-hole / web

Pi-hole Dashboard for stats and more
https://pi-hole.net
Other
2.05k stars 559 forks source link

Browsing via `http://pi.hole:8080/admin` redirects to `http://ip.address:8080/admin` #2654

Closed PromoFaux closed 1 year ago

PromoFaux commented 1 year ago

Not sure if this is an adminLTE/Docker/FTL thing, but I am observing the following behaviour from time to time.

Image

Any ideas?

DL6ER commented 1 year ago

This is indeed interesting and I am not able to fully reproduce it every time I tried it (it is kind of hit-and-miss).

However, what happens here is:

  1. You authenticate with pi.hole and this works (can be seen with debug.api = true in ftl.log)
  2. The web interface uses window.location.replace("/admin"); sending us to 192.168.1.253:8080/admin instead of pi.hole:8080/admin for unknown reason
  3. Your browser has valid login data for pi.hole but not for 192.168.1.253 so FTL (rightfully) redirects you to the login page (again)
DL6ER commented 1 year ago

Apparently, window.location needs an / at the end to work if there is no query string.

Proposed fix in AdminLTE:

  // Ensure the target ends in "/" if there is no query string
  if (target.indexOf("?") === -1 && target.slice(-1) !== "/") {
    target += "/";
  }
DL6ER commented 1 year ago

@PromoFaux Please try with AdminLTE branch fix/login_redirection

PromoFaux commented 1 year ago

Confirmed that branch fixes this. Moved this issue to adminLTE repo

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.

Ahmed-security commented 1 month ago

I can not do update or upgrade ?