I've resolved this by simply adding the line

ENV no_proxy jupyterhub


to my notebook's Dockerfile.

R


On Wednesday, 18 January 2017 23:25:42 UTC, Min RK wrote:
>
> On Wed, Jan 18, 2017 at 5:11 AM, Richard Dean <[email protected] 
> <javascript:>> wrote:
>
> 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!
>>
> 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 
> <https://github.com/jupyterhub/jupyterhub/blob/0.7.2/jupyterhub/services/auth.py#L158>.
>  
> This SO question 
> <http://stackoverflow.com/questions/28521535/requests-how-to-disable-bypass-proxy>
>  
> 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jupyter/0b2f5081-11d6-4088-a7fd-b4680573b38c%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jupyter/0b2f5081-11d6-4088-a7fd-b4680573b38c%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> ​
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/cd25328c-00ff-40a4-9944-470713174d72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to