Page 1 of 1

Infinite Redirect

Posted: February 4th, 2025, 5:55 pm
by CormoranTick
I'm getting an infinite redirect loop.

I have sabnzbd 4.4.1 running on port 8080 with HTTPs enabled. I have an nginx reverse proxy on the same network segment. Through the reverse proxy I can access the login page and successfully login (i.e. a session cookie is generated) and it redirects me to /. It then immediately redirects me to /login/ and then back to / etc.etc. until my browser stops it.

I am able to login directly via port 8080 without issue. Additionally, if I browse to the reverse proxy domain directly after logging in, it also works sometimes, though will randomly start redirecting as I move through the interface.

Something appears to be broken through the reverse proxy. In my logs I only see that the requests seem to be jumping between IPv4 and IPv6, but I forced the reverse proxy to use only one and the issue still showed up.

Any suggestions?

# Log files
aaaa:aaaa:aaaa::aaaa is the sanitized nginx IPv6 address
cccc:cccc:cccc::cccc is the sanitized client IPv6 address

Code: Select all

Feb 04 17:27:18 dl python3[363203]: 2025-02-04 17:27:18,615::DEBUG::[interface:144] Request GET /login/ from aaaa:aaaa:aaaa::aaaa (X-Forwarded-For: cccc:cccc:cccc::cccc)
Feb 04 17:27:18 dl python3[363203]: 2025-02-04 17:27:18,615::DEBUG::[interface:403] Request GET /login/ redirected to /
Feb 04 17:27:18 dl python3[363203]: 2025-02-04 17:27:18,683::DEBUG::[interface:144] Request GET / from ::ffff:10.0.0.123 (X-Forwarded-For: cccc:cccc:cccc::cccc)
Feb 04 17:27:18 dl python3[363203]: 2025-02-04 17:27:18,683::DEBUG::[interface:403] Request GET / redirected to /login/
Feb 04 17:27:18 dl python3[363203]: 2025-02-04 17:27:18,769::DEBUG::[interface:144] Request GET /login/ from aaaa:aaaa:aaaa::aaaa (X-Forwarded-For: cccc:cccc:cccc::cccc)
Feb 04 17:27:18 dl python3[363203]: 2025-02-04 17:27:18,769::DEBUG::[interface:403] Request GET /login/ redirected to /
Feb 04 17:27:18 dl python3[363203]: 2025-02-04 17:27:18,831::DEBUG::[interface:144] Request GET / from ::ffff:10.0.0.123 (X-Forwarded-For: cccc:cccc:cccc::cccc)
Feb 04 17:27:18 dl python3[363203]: 2025-02-04 17:27:18,832::DEBUG::[interface:403] Request GET / redirected to /login/
# nginx config

Code: Select all

    client_max_body_size 10m;
    client_body_buffer_size 128k;

    #Timeout if the real server is dead
    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;

    # Advanced Proxy Config
    send_timeout 5m;
    proxy_read_timeout 240;
    proxy_send_timeout 240;
    proxy_connect_timeout 240;

    # Basic Proxy Config
    include /etc/nginx/proxy_params;
    proxy_set_header X-Forwarded-Proto https;
    proxy_redirect  http://  $scheme://;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_cache_bypass $cookie_session;
    proxy_no_cache $cookie_session;
    proxy_buffers 32 4k;

    location / {
        proxy_pass https://<domain>:8080/;
    }

Re: Infinite Redirect

Posted: February 4th, 2025, 6:54 pm
by CormoranTick
It was because of the IP flapping.

Forcing the reverse proxy to call the upstream on either either IPv4 or IPv6 only, resolves the issue. However I don't have this problem with any other application behind the proxy, so I still this it might be a SAB bug.

Re: Infinite Redirect

Posted: February 5th, 2025, 1:01 am
by sander

Re: Infinite Redirect

Posted: February 5th, 2025, 1:14 am
by CormoranTick
sander wrote: February 5th, 2025, 1:01 am your post too https://github.com/sabnzbd/sabnzbd/issues/3028 ?
Yeah. Wasn't sure which was more appropriate to post for this, form or github. I closed the github issue though, because it's probably not a bug, and if it is it seems more and more liekly that it's an nginx thing not sab.

Still boggling my mind why it won't just pick an IP. ???

Oh well.