Another "redirect loop" thread (original) (raw)
I’m trying to get JupyterHub and Notebook running in a Podman (Docker) container for testing - the idea is to test new python modules there before turning them loose in production. This environment has just a single user at the moment (jupytersi), and the idea is to start the sub-servers within the same container - not to start a new container for each server.
The application starts up, and I can connect via a tunnelled connection on port 26888. When I start a server for the user, I get the redirect loop. Note: I’m mimicing the production config, and I didn’t choose the ports; for the container, I changed to the dummy authentication.
One bit I don’t understand is why it’s using the network gateway address (172.24.8.1) as the destination - this doesn’t appear anywhere in the config.
[I 2025-04-25 08:07:02.819 ServerApp] 200 GET /user/jupytersi/api (@127.0.0.1) 1.23ms
[I 2025-04-25 08:07:02.819 JupyterHub base:1124] User jupytersi took 3.389 seconds to start
[I 2025-04-25 08:07:02.819 JupyterHub proxy:331] Adding user jupytersi to proxy /user/jupytersi/ => http://127.0.0.1:41177
[I 2025-04-25 08:07:02.823 JupyterHub users:899] Server jupytersi is ready
[I 2025-04-25 08:07:02.824 JupyterHub log:192] 200 GET /hub/api/users/jupytersi/server/progress?_xsrf=[secret] (jupytersi@172.24.8.1) 2323.98ms
[I 2025-04-25 08:07:02.842 JupyterHub log:192] 302 GET /hub/spawn-pending/jupytersi → /user/jupytersi/ (jupytersi@172.24.8.1) 5.50ms
[I 2025-04-25 08:07:02.850 JupyterHub log:192] 302 GET /user/jupytersi/ → /hub/user/jupytersi/ (@172.24.8.1) 0.75ms
[I 2025-04-25 08:07:02.861 JupyterHub log:192] 302 GET /hub/user/jupytersi/ → /user/jupytersi/?redirects=1 (jupytersi@172.24.8.1) 4.47ms
[I 2025-04-25 08:07:02.868 JupyterHub log:192] 302 GET /user/jupytersi/?redirects=1 → /hub/user/jupytersi/?redirects=1 (@172.24.8.1) 0.69ms
[W 2025-04-25 08:07:02.877 JupyterHub base:1844] Redirect loop detected on /hub/user/jupytersi/?redirects=1
[I 2025-04-25 08:07:04.878 JupyterHub log:192] 302 GET /hub/user/jupytersi/?redirects=1 → /user/jupytersi/?redirects=2 (jupytersi@172.24.8.1) 2004.68ms
[I 2025-04-25 08:07:04.886 JupyterHub log:192] 302 GET /user/jupytersi/?redirects=2 → /hub/user/jupytersi/?redirects=2 (@172.24.8.1) 0.80ms
[W 2025-04-25 08:07:04.896 JupyterHub base:1844] Redirect loop detected on /hub/user/jupytersi/?redirects=2
[I 2025-04-25 08:07:08.897 JupyterHub log:192] 302 GET /hub/user/jupytersi/?redirects=2 → /user/jupytersi/?redirects=3 (jupytersi@172.24.8.1) 4005.27ms
[I 2025-04-25 08:07:08.906 JupyterHub log:192] 302 GET /user/jupytersi/?redirects=3 → /hub/user/jupytersi/?redirects=3 (@172.24.8.1) 0.82ms
[W 2025-04-25 08:07:08.916 JupyterHub base:1844] Redirect loop detected on /hub/user/jupytersi/?redirects=3
[I 2025-04-25 08:07:16.918 JupyterHub log:192] 302 GET /hub/user/jupytersi/?redirects=3 → /user/jupytersi/?redirects=4 (jupytersi@172.24.8.1) 8006.51ms
[I 2025-04-25 08:07:16.926 JupyterHub log:192] 302 GET /user/jupytersi/?redirects=4 → /hub/user/jupytersi/?redirects=4 (@172.24.8.1) 0.90ms
[W 2025-04-25 08:07:16.938 JupyterHub web:1873] 500 GET /hub/user/jupytersi/?redirects=4 (172.24.8.1): Redirect loop detected.
JupyterHub 5.2.1 20250425072327
egrep -i “http|port|ip|url” jupyterhub_config.py |grep -iv “#” | sort
c.ConfigurableHTTPProxy.should_start = False
c.JupyterHub.bind_url = ‘http://172.24.8.109:26843’
c.JupyterHub.db_url = ‘sqlite:////data/jupyter/jupyterhub/data/jupyterhub.sqlite’
c.JupyterHub.hub_connect_ip = ‘172.24.8.109’
c.JupyterHub.hub_connect_url = ‘http://172.24.8.109:26888’
c.JupyterHub.hub_ip = ‘172.24.8.109’
c.JupyterHub.hub_port = 26888
c.Proxy.api_url = ‘http://127.0.0.1:26880’
c.Spawner.default_url = ‘/tree/{username}’
c.Spawner.ip = ‘127.0.0.1’
minrk April 25, 2025, 6:28pm 2
The redirect loop suggests that you are connecting directly to the Hub and not via the proxy.
Looking at
and
it looks like you should be connecting to port 26843. 26888 is the unproxied Hub port, which will never be redirected to user servers. The only things that should connect directly to this port are the Hub and single-user servers, never browsers.
The jupytersi@172.24.8.1
is logging the origin ip of the request (the client ip), as seen by the Hub.