Jupyterhub behind Nginx reverse proxy can't access kernels

2,523 views
Skip to first unread message

Peter Sprague

unread,
Mar 18, 2016, 2:31:36 PM3/18/16
to Project Jupyter
Jupyterhub works well when I access it directly on port 8000.  Once I attempt to bring a Nginx reverse proxy into the stream, site is accessed, notebooks open, but R or Python kernels are not connecting.

Here is my Nginx config:

    #jupyterhub.geovisionenvironmental.com
    server {
        listen 8279;
        server_name jupyterhub.geovisionenvironmental.com
                    jupyterhub.geovisionenvironmental.ca;

        location  /  {
                # pass to x.x.x.x jupyterhub iocage jail
                proxy_set_header HOST $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-NginX-Proxy true;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                #proxy_bind x.x.x.x;
                proxy_pass http://x.x.x.x:8000;
        }

    }

Likely have more proxy_set_header commands than needed.

Any ideas or suggestions?

Peter

Ryan Lovett

unread,
Mar 22, 2016, 4:32:09 PM3/22/16
to Project Jupyter
We have something similar, based on the compmodels repo, which additionally proxies web sockets. E.g.

location ~* /(user/[^/]*)/(api/kernels/[^/]+/channels|terminals/websocket)/? {
    proxy_pass http://{{ jupyterhub_host }}:8000;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-NginX-Proxy true;

    # WebSocket support
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_read_timeout 86400;

Luke Segars

unread,
May 17, 2016, 7:11:18 PM5/17/16
to Project Jupyter
Peter, did you ever find a solution to this? I'm encountering the same problem with a very similar nginx configuration and haven't been able to get variants of Ryan's configuration working yet.

Andrea Zonca

unread,
May 19, 2016, 12:56:15 AM5/19/16
to Project Jupyter
hi,
I also adapted the configuration from compmodels and works fine, see:


cheers,
Andrea

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/8aff26d3-2347-4bfe-8c77-a9425bbd3bf3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages