502 bad gateway

547 views
Skip to first unread message

Richard Dean

unread,
Jan 18, 2017, 10:11:23 AM1/18/17
to Project Jupyter
Hi there,

I keep getting "502 : Bad Gateway.. Failed to check authorization (upstream problem)" when using a jupyterhub (via docker) with a docker version of the jupyter data science notebook.

My notebook docker file looks a bit like this:

FROM jupyter/datascience-notebook:latest

ENV http_proxy http://x.x.x.x:8080
ENV https_proxy http://x.x.x.x:8080
ENV no_proxy  
 

# install some additional packages here
... 

This works fine when firing up the notebook, and the proxies remain set so I can connect to the internet as per usual.

The same setup doesn't work, however, for JupyterHub. I can access the hub front end and successfully authenticate but then immediately get the 502 bad gateway error.

I've found a work around which is to remove the proxy setting at the end of the notebook dockerfile like so:

ENV http_proxy ""

I can log in to the hub, run scripts and access the terminal as expected, apart from always having to manually specify the proxy when connecting to a website or running command line tools.

I think that the problem lies in the http_proxy setting somehow disrupting the hub's own proxy and therefore the user's notebook is firing up in the background but 

I suspect that I'm missing an obvious setting somewhere and have tried my best to follow up any promising matches when searching through existing issues and this group but still no success.

Where should I look? Any help appreciated!

Cheers,

Richard.



MinRK

unread,
Jan 18, 2017, 6:25:42 PM1/18/17
to Project Jupyter

I think the proxy setting is affecting the connection between the single-user server and the Hub itself, because that connection is getting proxied and the proxy cannot see the Hub. I think you will need to tell the single-user server’s API requests to the Hub to ignore your http_proxy environment variable. The code that makes the request is here. This SO question seems to have a solution for telling requests to ignore environment variables such as the proxy setting. I’m not certain if this is the right fix, since it might introduce other bugs, but it would fix this case at least.

-Min


Cheers,

Richard.



--
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+unsubscribe@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/0b2f5081-11d6-4088-a7fd-b4680573b38c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Richard Dean

unread,
Jan 19, 2017, 5:34:38 AM1/19/17
to Project Jupyter
I've resolved this by simply adding the line

ENV no_proxy jupyterhub

to my notebook's Dockerfile.

R


Cheers,

Richard.



To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages