ajnart / homarr

Customizable browser's home page to interact with your homeserver's Docker containers (e.g. Sonarr/Radarr)
https://homarr.dev
MIT License
6k stars 275 forks source link

OIDC redirect not working due to incorrect header naming #2000

Closed nojomyth-dev closed 5 months ago

nojomyth-dev commented 5 months ago

Environment

Docker

Version

0.15.2

Describe the problem

PR #1911 has added automatic extraction of the redirectURL for OIDC. However, it doesn't seem to work for headers of the form X-Forwarded-*, only in the lower case variant. It redirects to localhost behind a traefik.

The documentation specifies that you can simply use BASE_URL for the redirect, however, i don't see how that's possible with this code. A way to override this behavior would be cool since traefik automatically changes all headers.

Here are the headers:

Hostname: <redacted, hex>
IP: 127.0.0.1
IP: <redacted>
RemoteAddr: <redacted>
GET / HTTP/1.1
Host: <redacted, form: example.com>
User-Agent: <redacted>
Accept: <redacted>
Accept-Encoding: gzip, deflate, br
Accept-Language: de,en-US;q=0.7,en;q=0.3
Cookie: color-scheme=dark; next-auth.csrf-token=<redacted>; next-auth.callback-url=<redacted, form: example.com>; config-locale=en
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Te: trailers
Upgrade-Insecure-Requests: 1
X-Forwarded-For: <redacted, internal IP>
X-Forwarded-Host: <redacted, example.com>
X-Forwarded-Port: 443
X-Forwarded-Proto: https
X-Forwarded-Server: traefik
X-Real-Ip: <redacted>

Logs

No response

Context

Maybe it's an issue with lower case / upper case headers

Please tick the boxes

Meierschlumpf commented 5 months ago

@nojomyth-dev were you able to solve it yourself? If so could you describe how you did it so others running in the same issue can fix it easier?

nojomyth-dev commented 5 months ago

Wasn't able to solve it, currently migrating to another dashboard with external authentication; thus i can't test possible fixes anymore.

nojomyth-dev commented 5 months ago

Appendix: I tried to build it since i couldn't find the files of the tag / branch / pr inside the container (oidc js files were missing), but gave up after it took 10min to yarn install + build it and the dockerfile build was not working locally due to a missing .next folder

Meierschlumpf commented 5 months ago

Okay thanks and good luck with the other one 👍🏼