Jupyterhub configuration behind the proxy

Hello,
I have 2 issues related to jupyterhub installation behind my proxy server:

  1. While using dummy authentication everything works fine. While using github authentication, immediately after providing the github credentials, I receive a message that the site is unreachable.

I guess that I need to set up the http_proxy, https_proxy and no_proxy environment variables with my proxy IP address to allow access to github but I don’t which pods I need to set these variables up for and how to do it properly. I tried to set it up manually for hub pod (via adding them to deployment file of this hub pod) but it does not work.

  1. Even after successful authorization, I don’t know how to set up the http_proxy, https_proxy and no_proxy variables for the pod with my jupyter server. If I don’t set them up, I don’t have the access to the internet from this pod:
    image

If I set it up explicitly in jupyter notebook, it works fine:
image

… but I would like to avoid adding them manually each time. I tried to add the following configuratrion to config.yaml:

singleuser:
  extraEnv:
    HTTP_PROXY: "http://XXX.XX.XX.XXX:XXXX"
    HTTPS_PROXY: "http://XXX.XX.XX.XXX:XXXX"

…, but then the pod with jupyter server is not created at all:
image

Could you please help me to solve these both issues? Thank you!

Hi! You haven’t given us much information on your setup, but I’m assuming you’re using Zero to JupyterHub with Kubernetes — Zero to JupyterHub with Kubernetes documentation ? Which version are you using? It would also be helpful if you showed us your configuration with secrets redacted.

There’s a hub.extraEnv property:

You only want external http requests (to outside your network) to go through the proxy, presumably setting the environment variables at the pod level results in communication to the hub going through the proxy and failing to reach the hub. You could try setting no_proxy

but if you’re using Z2JH the hub IP may change.

Alternatively you could try creating a custom kernelspec with environment variables: