I’m unable to run admin commands from the hub control panel via the web interface. I’m running JupyterHub 1.1.0 on Ubuntu 18.04 LTS. Sessions are spawned using DockerSpawner via SystemUserSpawner. I use nginx reverse proxy via an intermediary server. All notebook functions work fine. The only issue is with my admin functions. All admins are affected included a new dummy admin that I created. I’ve read some on 403 errors, but they all seem to be dealing with specific users not being able to access their notebooks due to the JupyterHub database being reset. I’ve tried removing my containers just to eliminate that as a possible reason, but the issue still persists. I’m assuming the issue has to do with the reverse proxy, but I’m not sure. Any advice on next steps? Thanks!
Unable to run admin commands in the Hub Control Panel web interface - API request failed (403): Forbidden
Hi! Please could you show us your JupyterHub logs corresponding to the faiied requests? It may help to run jupyterhub with the
--debug option to show more info in the logs.
When I “Stop All” I get this.
[W 2020-06-12 13:24:27.569 JupyterHub base:60] Blocking Cross Origin API request. Referer: https://jomi.ees.vanderbilt.edu/nodi/jupyter/hub/admin, Host: localhost:8723/nodi/jupyter/hub/
[W 2020-06-12 13:24:27.570 JupyterHub log:174] 403 DELETE /nodi/jupyter/hub/api/users/chris/server (@220.127.116.11) 13.80ms
Also, another symtom that I think may be related… At the page with “Your server is starting up” at login, it just hangs. I have to refresh it to redirect to the spawned notebook.
This could be the problem, it looks like the
Host header may be dropped by one of the proxies. Are you able to get any logs from Nginx and also the intermediate proxy? Alternatively are you able to test without one of those proxies, as that would help to narrow down the problem.
I think you’re right that the issue is with the proxies. I didn’t configured them. One of the other admins is going to look into the nginx configs. I’m unsure when they’ll have a chance to get to it, but I’ll update when I hear more. Thanks for the help!
Okay. The other admin doesn’t have the time to delve into this right now, but I’m going to try to investigate it. I’m pretty unfamiliar with nginx, but I was able to look through some of the logs and I think I found where the error is occurring. For context, here’s my config…
Client -> jomi (nginx reverse proxy) -> nodi (nginx reverse proxy) -> nodi (JupyterHub)
jomi and nodi are the server names.
On nodi, the nginx error log shows this after attempting to perform an admin function (in this case “Stop Servers”).
2020/06/13 14:32:45 [error] 4998#4998: *38832 connect() failed (111: Connection refused) while connecting to upstream, client: 18.104.22.168, server: nodi.ees.vanderbilt.edu, request: "GET /nodi/jupyter/user/chris/api/terminals?1592076765216 HTTP/1.1", upstream: "http://[::1]:8723/nodi/jupyter/user/chris/api/terminals?1592076765216", host: "nodi.ees.vanderbilt.edu", referrer: "https://jomi.ees.vanderbilt.edu/nodi/jupyter/user/chris/lab" 2020/06/13 14:32:45 [warn] 4998#4998: *38832 upstream server temporarily disabled while connecting to upstream, client: 22.214.171.124, server: nodi.ees.vanderbilt.edu, request: "GET /nodi/jupyter/user/chris/api/terminals?1592076765216 HTTP/1.1", upstream: "http://[::1]:8723/nodi/jupyter/user/chris/api/terminals?1592076765216", host: "nodi.ees.vanderbilt.edu", referrer: "https://jomi.ees.vanderbilt.edu/nodi/jupyter/user/chris/lab"
It looks like the problem is confined to nodi, I think? Any idea where to go from here?
Bingo! This was the problem. One of the servers was missing
proxy_set_header Host $host;
Both the spawner status bar and admin commands now work properly! Thank you for your help @manics!