Failed to check authorization (upstream problem)

I’m struggling to get jupyerhub up and running.
Specially spawning jupyernotebooks.

I can login to jupyerhub but the spawner does not start jupyter_notebook right.
The url changes to oauth_callback?code= but I don’t use OAuth??

The jupyter_notebook container ist starting but brings the following error:

Both hub and notebook are in the same network:

"Containers": {
   "67858e937b69b28d096d507734d62f1ad26e628df2b2b0523ebce6a083ee47ab": {
        "Name": "jupyter-name",
        "IPv4Address": "192.168.96.3/20",
    },
    "b54c7cc972a21bb1966b8b01ca7cc199c6961ef3e9a0736424b437dcfb87840b": {
        "Name": "jupyterhub",
        "MacAddress": "02:42:c0:a8:60:02",
        "IPv4Address": "192.168.96.2/20",
    }
}

My setup:

docker-compose.yml:

version: "3"
services:
  jupyterhub:
    build:
      context: "/opt/jupyter/hub"
    image: mmw/jupyterhub:1.3
    container_name: jupyterhub
    env_file:
      - /opt/jupyter/.env
    networks:
      default:
      jupyter_net:
        aliases:
          - jupyterhub-net
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/jupyter/hub:/srv/jupyterhub
      - /opt/jupyter/hub/jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py
    restart: on-failure
  proxy:
    image: nginx:1.19.9
    container_name: jupyterhub-proxy
    ports:
      - 80:80
      - 443:443
    networks:
      default:
    volumes:
      - /opt/nginx/jupyterhub.conf:/etc/nginx/conf.d/jupyterhub.conf:z
      - /var/log/nginx:/var/log/nginx
      - /etc/ssl/certs/adsf.crt:/etc/nginx/conf.d/asdf.crt
      - /etc/ssl/private/asdf.pem:/etc/nginx/conf.d/asdf.pem
    restart: always
    links:
      - "jupyterhub"
  jupyterlab:
    build:
      context: "/opt/jupyter/notebook"
    image: asdf/jupyter_lab:test
    container_name: jupyterlab-throwaway
    network_mode: none
    command: echo
networks:
  default:
  jupyter_net:
    name: 'jupyter_net'

jupyerhub_config.py:

import os, sys
docker_machine_name = os.environ['DOCKER_MACHINE_NAME'] or 'jupyterhub'
c.JupyterHub.hub_ip = '0.0.0.0'
c.JupyterHub.hub_connect_ip = docker_machine_name
c.JupyterHub.port = 8000
c.JupyterHub.shutdown_on_logout = True
c.JupyterHub.cleanup_servers = False
c.JupyterHub.allow_named_servers = True
c.JupyterHub.named_server_limit_per_user = 2
c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
c.LDAPAuthenticator.server_address = 'ldaps://adsf.asdf.asdf'
c.LDAPAuthenticator.server_port = 636
c.LDAPAuthenticator.use_ssl = True
c.LDAPAuthenticator.bind_dn_template = 'CN={username},CN=Users,DC=asdf,DC=asdf'
c.LDAPAuthenticator.lookup_dn = True
c.LDAPAuthenticator.lookup_dn_search_filter = '({login_attr}={login})'
c.LDAPAuthenticator.lookup_dn_search_user = 'CN=adsf,CN=Users,DC=asdf,DC=asdf'
c.LDAPAuthenticator.lookup_dn_search_password = 'adsf'
c.LDAPAuthenticator.lookup_dn_user_dn_attribute = 'cn'
c.LDAPAuthenticator.user_search_base = 'cn=Users,DC=asdf,DC=asdf'
c.LDAPAuthenticator.user_attribute = 'sAMAccountName'
c.LDAPAuthenticator.allowed_groups = [
    'CN=adsf,OU=asdf,DC=asdf,DC=asdf',
]
c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'
docker_notebook_image = os.environ['DOCKER_NOTEBOOK_IMAGE'] or 'jupyter/minimal-notebook:4d9c9bd9ced0'
c.DockerSpawner.image = docker_notebook_image
c.Spawner.cmd=["start-notebook.sh"]
network_name = os.environ['DOCKER_NETWORK_NAME'] or 'jupyter_net'
c.DockerSpawner.network_name = network_name
c.DockerSpawner.use_internal_ip = True
c.Spawner.disable_user_config = True
c.Spawner.cpu_limit = 1
c.Spawner.mem_limit = '10G'

nginx.conf:

upstream notebook {
    server jupyterhub:8000;
}
map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
}
server {
    listen                    80;
    listen                    [::]:80;
    server_name               asdf.asdf;

    return 302                https://$host$request_uri;
}
server {
    listen                    443 ssl;
    server_name               asdf.asdf;
    access_log                /var/log/nginx/nginx.access.log;
    error_log                 /var/log/nginx/nginx.error.log;
    ssl_certificate           /etc/nginx/conf.d/asdf.asdf.crt;
    ssl_certificate_key       /etc/nginx/conf.d/asdf.asdf.pem;
    ssl_protocols             TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_dhparam               /etc/nginx/conf.d/dhparam.pem;
    ssl_ciphers               'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
    ssl_session_timeout       1d;
    ssl_session_cache         shared:SSL:50m;
    ssl_stapling              on;
    ssl_stapling_verify       on;
    add_header                Strict-Transport-Security max-age=15768000;
    add_header                X-Frame-Options DENY;
    client_max_body_size      0;
    location / {
        proxy_pass            http://notebook;
        proxy_set_header      X-Real-IP $remote_addr;
        proxy_set_header      Host $http_host;
        proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_http_version    1.1;
        proxy_set_header      Upgrade $http_upgrade;
        proxy_set_header      Connection $connection_upgrade;
        proxy_set_header      X-Forwarded-Proto $scheme;
        proxy_read_timeout    86400;
        proxy_buffering       off;
    }
}

Found error from jupyter_notebook:

<h1>ERROR</h1>
    <h2>The requested URL could not be retrieved</h2>
    </div>
    <hr>

    <div id="content">
    <p>The following error was encountered while trying to retrieve the URL: <a href="http://jupyterhub:8081/hub/api/oauth2/token">http://jupyterhub:8081/hub/api/oauth2/token</a></p>

    <blockquote id="error">
    <p><b>Unable to determine IP address from host name <q>jupyterhub</q></b></p>
    </blockquote>

    <p>The DNS server returned:</p>
    <blockquote id="data">
    <pre>No DNS records</pre>
    </blockquote>

    <p>This means that the cache was not able to resolve the hostname presented in the URL. Check if the address is correct.</p>

Hi! Could you turn on debug logging and show us your JupyterHub and Nginx logs?

If you use the DummyAuthenticator instead of LDAPAuthenticator do you still see this problem?

The actual error message implies

can’t be reached by Nginx.

To be sure. Nginx can reach server jupyterhub:8000;
The jupyter_notebook cannot reach the hub while initializing.

jupyterhub logs:

jupyterhub    | [D 2021-04-14 05:48:49.775 JupyterHub utils:224] Server at http://192.168.128.3:8888/user/haag/dev/ responded with 302
jupyterhub    | [D 2021-04-14 05:48:49.775 JupyterHub _version:76] jupyterhub and jupyterhub-singleuser both on version 1.3.0
jupyterhub    | [I 2021-04-14 05:48:49.775 JupyterHub base:904] User haag:dev took 2.315 seconds to start
jupyterhub    | [I 2021-04-14 05:48:49.776 JupyterHub proxy:257] Adding user haag to proxy /user/haag/dev/ => http://192.168.128.3:8888
jupyterhub    | [D 2021-04-14 05:48:49.776 JupyterHub proxy:795] Proxy: Fetching POST http://127.0.0.1:8001/api/routes/user/haag/dev
jupyterhub    | 05:48:49.777 [ConfigProxy] info: Adding route /user/haag/dev -> http://192.168.128.3:8888
jupyterhub    | 05:48:49.777 [ConfigProxy] info: Route added /user/haag/dev -> http://192.168.128.3:8888
jupyterhub    | 05:48:49.778 [ConfigProxy] info: 201 POST /api/routes/user/haag/dev
jupyterhub    | [I 2021-04-14 05:48:49.778 JupyterHub users:664] Server haag:dev is ready
jupyterhub    | [I 2021-04-14 05:48:49.779 JupyterHub log:181] 200 GET /hub/api/users/haag/servers/dev/progress (haag@asdf) 1260.03ms
jupyterhub    | [I 2021-04-14 05:48:49.782 JupyterHub log:181] 200 GET /hub/api (@192.168.128.3) 0.56ms
jupyterhub    | [D 2021-04-14 05:48:49.789 JupyterHub base:283] Recording first activity for <APIToken('b61e...', user='haag')>
jupyterhub    | [D 2021-04-14 05:48:49.809 JupyterHub users:765] Activity for user haag: 2021-04-14T05:48:48.923384Z
jupyterhub    | [D 2021-04-14 05:48:49.809 JupyterHub users:783] Activity on server haag/dev: 2021-04-14T05:48:48.923384Z
jupyterhub    | [I 2021-04-14 05:48:49.825 JupyterHub log:181] 200 POST /hub/api/users/haag/activity (haag@192.168.128.3) 37.30ms
jupyterhub    | [I 2021-04-14 05:48:49.828 JupyterHub log:181] 302 GET /hub/spawn-pending/haag/dev -> /user/haag/dev (haag@asdf) 2.45ms
jupyterhub    | [D 2021-04-14 05:48:49.845 JupyterHub provider:409] Validating client id jupyterhub-user-haag-dev
jupyterhub    | [D 2021-04-14 05:48:49.846 JupyterHub provider:484] validate_redirect_uri: client_id=jupyterhub-user-haag-dev, redirect_uri=/user/haag/dev/oauth_callback
jupyterhub    | [D 2021-04-14 05:48:49.847 JupyterHub base:521] Setting cookie jupyterhub-session-id: {'httponly': True}
jupyterhub    | [D 2021-04-14 05:48:49.848 JupyterHub auth:244] Skipping oauth confirmation for <User(haag 1/2 running)> accessing Server at /user/haag/dev/
jupyterhub    | [D 2021-04-14 05:48:49.848 JupyterHub provider:409] Validating client id jupyterhub-user-haag-dev
jupyterhub    | [D 2021-04-14 05:48:49.849 JupyterHub provider:484] validate_redirect_uri: client_id=jupyterhub-user-haag-dev, redirect_uri=/user/haag/dev/oauth_callback
jupyterhub    | [D 2021-04-14 05:48:49.850 JupyterHub provider:231] Saving authorization code jupyterhub-user-haag-dev, dI9..., (), {}
jupyterhub    | [I 2021-04-14 05:48:49.867 JupyterHub log:181] 302 GET /hub/api/oauth2/authorize?client_id=jupyterhub-user-haag-dev&redirect_uri=%2Fuser%2Fhaag%2Fdev%2Foauth_callback&response_type=code&state=[secret] -> /user/haag/dev/oauth_callback?code=[secret]&state=[secret] (haag@asdf) 22.97ms

nginx logs:

==> nginx.access.log <==
it.hurts.when.IP.53 - - [14/Apr/2021:05:48:49 +0000] "GET /user/haag/dev/static/components/jquery-typeahead/dist/jquery.typeahead.min.css?v=5edf53bf6bb9c3b1ddafd8594825a7e2ed621f19423e569c985162742f63911c09eba2c529f8fb47aebf27fafdfe287d563347f58c1126b278189a18871b6a9a HTTP/1.1" 200 11518 "https://hostname/user/haag/dev/oauth_callback?code=dI9fwFB2lHYLEiC3Fa4Q4mhbFdc9Q1&state=eyJ1dWlkIjogIjA1NTM1ODkwYzMxNjRiNzNiODMzNDQyMTY4ZjNhMjMxIiwgIm5leHRfdXJsIjogIi91c2VyL2hhYWcvZGV2L2xhYj8ifQ" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
it.hurts.when.IP.53 - - [14/Apr/2021:05:48:49 +0000] "GET /user/haag/dev/custom/custom.css HTTP/1.1" 200 135 "https://hostname/user/haag/dev/oauth_callback?code=dI9fwFB2lHYLEiC3Fa4Q4mhbFdc9Q1&state=eyJ1dWlkIjogIjA1NTM1ODkwYzMxNjRiNzNiODMzNDQyMTY4ZjNhMjMxIiwgIm5leHRfdXJsIjogIi91c2VyL2hhYWcvZGV2L2xhYj8ifQ" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
it.hurts.when.IP.53 - - [14/Apr/2021:05:48:49 +0000] "GET /user/haag/dev/static/components/es6-promise/promise.min.js?v=bea335d74136a63ae1b5130f5ac9a50c6256a5f435e6e09fef599491a84d834a8b0f011ca3eaaca3b4ab6a2da2d3e1191567a2f171e60da1d10e5b9d52f84184 HTTP/1.1" 200 5192 "https://hostname/user/haag/dev/oauth_callback?code=dI9fwFB2lHYLEiC3Fa4Q4mhbFdc9Q1&state=eyJ1dWlkIjogIjA1NTM1ODkwYzMxNjRiNzNiODMzNDQyMTY4ZjNhMjMxIiwgIm5leHRfdXJsIjogIi91c2VyL2hhYWcvZGV2L2xhYj8ifQ" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
it.hurts.when.IP.53 - - [14/Apr/2021:05:48:49 +0000] "GET /user/haag/dev/static/components/react/react.production.min.js?v=9a0aaf84a316c8bedd6c2ff7d5b5e0a13f8f84ec02442346cba0b842c6c81a6bf6176e64f3675c2ebf357cb5bb048e0b527bd39377c95681d22468da3d5de735 HTTP/1.1" 200 6588 "https://hostname/user/haag/dev/oauth_callback?code=dI9fwFB2lHYLEiC3Fa4Q4mhbFdc9Q1&state=eyJ1dWlkIjogIjA1NTM1ODkwYzMxNjRiNzNiODMzNDQyMTY4ZjNhMjMxIiwgIm5leHRfdXJsIjogIi91c2VyL2hhYWcvZGV2L2xhYj8ifQ" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
it.hurts.when.IP.53 - - [14/Apr/2021:05:48:49 +0000] "GET /user/haag/dev/static/style/style.min.css?v=56dfd556850eb17b7998c6828467598a322b41593edc758739c66cb2c3fea98f23d0dd8bf8b9b0f5d67bb976a50e4c34f789fe640cbb440fa089e1bf5ec170bd HTTP/1.1" 200 266775 "https://hostname/user/haag/dev/oauth_callback?code=dI9fwFB2lHYLEiC3Fa4Q4mhbFdc9Q1&state=eyJ1dWlkIjogIjA1NTM1ODkwYzMxNjRiNzNiODMzNDQyMTY4ZjNhMjMxIiwgIm5leHRfdXJsIjogIi91c2VyL2hhYWcvZGV2L2xhYj8ifQ" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
it.hurts.when.IP.53 - - [14/Apr/2021:05:48:49 +0000] "GET /user/haag/dev/static/components/react/react-dom.production.min.js?v=6fc58c1c4736868ff84f57bd8b85f2bdb985993a9392718f3b4af4bfa10fb4efba2b4ddd68644bd2a8daf0619a3844944c9c43f8528364a1aa6fc01ec1b8ae84 HTTP/1.1" 200 102890 "https://hostname/user/haag/dev/oauth_callback?code=dI9fwFB2lHYLEiC3Fa4Q4mhbFdc9Q1&state=eyJ1dWlkIjogIjA1NTM1ODkwYzMxNjRiNzNiODMzNDQyMTY4ZjNhMjMxIiwgIm5leHRfdXJsIjogIi91c2VyL2hhYWcvZGV2L2xhYj8ifQ" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
it.hurts.when.IP.53 - - [14/Apr/2021:05:48:49 +0000] "GET /user/haag/dev/static/components/create-react-class/index.js?v=894ad57246e682b4cfbe7cd5e408dcd6b38d06af4de4f3425991e2676fdc2ef1732cbd19903104198878ae77de12a1996de3e7da3a467fb226bdda8f4618faec HTTP/1.1" 200 7462 "https://hostname/user/haag/dev/oauth_callback?code=dI9fwFB2lHYLEiC3Fa4Q4mhbFdc9Q1&state=eyJ1dWlkIjogIjA1NTM1ODkwYzMxNjRiNzNiODMzNDQyMTY4ZjNhMjMxIiwgIm5leHRfdXJsIjogIi91c2VyL2hhYWcvZGV2L2xhYj8ifQ" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
it.hurts.when.IP.53 - - [14/Apr/2021:05:48:49 +0000] "GET /user/haag/dev/static/components/requirejs/require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593 HTTP/1.1" 200 86262 "https://hostname/user/haag/dev/oauth_callback?code=dI9fwFB2lHYLEiC3Fa4Q4mhbFdc9Q1&state=eyJ1dWlkIjogIjA1NTM1ODkwYzMxNjRiNzNiODMzNDQyMTY4ZjNhMjMxIiwgIm5leHRfdXJsIjogIi91c2VyL2hhYWcvZGV2L2xhYj8ifQ" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
it.hurts.when.IP.53 - - [14/Apr/2021:05:48:50 +0000] "GET /user/haag/dev/static/components/jquery/jquery.min.js?v=20210414054848 HTTP/1.1" 200 89476 "https://hostname/user/haag/dev/oauth_callback?code=dI9fwFB2lHYLEiC3Fa4Q4mhbFdc9Q1&state=eyJ1dWlkIjogIjA1NTM1ODkwYzMxNjRiNzNiODMzNDQyMTY4ZjNhMjMxIiwgIm5leHRfdXJsIjogIi91c2VyL2hhYWcvZGV2L2xhYj8ifQ" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
it.hurts.when.IP.53 - - [14/Apr/2021:05:48:50 +0000] "GET /user/haag/dev/static/base/images/favicon.ico?v=50afa725b5de8b00030139d09b38620224d4e7dba47c07ef0e86d4643f30c9bfe6bb7e1a4a1c561aa32834480909a4b6fe7cd1e17f7159330b6b5914bf45a880 HTTP/1.1" 200 32038 "https://hostname/user/haag/dev/oauth_callback?code=dI9fwFB2lHYLEiC3Fa4Q4mhbFdc9Q1&state=eyJ1dWlkIjogIjA1NTM1ODkwYzMxNjRiNzNiODMzNDQyMTY4ZjNhMjMxIiwgIm5leHRfdXJsIjogIi91c2VyL2hhYWcvZGV2L2xhYj8ifQ" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"

==> nginx.error.log <==
2021/04/13 14:08:02 [error] 31#31: *146 upstream sent invalid chunked response while reading upstream, client: it.hurts.when.IP.50, server: hostname, request: "GET /hub/api/users/haag/servers/adsf/progress HTTP/1.1", upstream: "http://172.24.0.2:8000/hub/api/users/haag/servers/adsf/progress", host: "hostname", referrer: "https://hostname/hub/spawn-pending/haag/adsf"
2021/04/13 14:08:05 [error] 31#31: *148 upstream sent invalid chunked response while reading upstream, client: it.hurts.when.IP.50, server: hostname, request: "GET /hub/api/users/haag/servers/adsf/progress HTTP/1.1", upstream: "http://172.24.0.2:8000/hub/api/users/haag/servers/adsf/progress", host: "hostname", referrer: "https://hostname/hub/spawn-pending/haag/adsf"
2021/04/13 14:08:08 [error] 31#31: *150 upstream sent invalid chunked response while reading upstream, client: it.hurts.when.IP.50, server: hostname, request: "GET /hub/api/users/haag/servers/adsf/progress HTTP/1.1", upstream: "http://172.24.0.2:8000/hub/api/users/haag/servers/adsf/progress", host: "hostname", referrer: "https://hostname/hub/spawn-pending/haag/adsf"
2021/04/13 14:08:11 [error] 31#31: *152 upstream sent invalid chunked response while reading upstream, client: it.hurts.when.IP.50, server: hostname, request: "GET /hub/api/users/haag/servers/adsf/progress HTTP/1.1", upstream: "http://172.24.0.2:8000/hub/api/users/haag/servers/adsf/progress", host: "hostname", referrer: "https://hostname/hub/spawn-pending/haag/adsf"
2021/04/13 14:10:04 [error] 33#33: *1 upstream sent invalid chunked response while reading upstream, client: it.hurts.when.IP.50, server: hostname, request: "GET /hub/api/users/haag/server/progress HTTP/1.1", upstream: "http://172.28.0.2:8000/hub/api/users/haag/server/progress", host: "hostname", referrer: "https://hostname/hub/spawn-pending/haag"
2021/04/13 14:10:09 [error] 33#33: *11 upstream prematurely closed connection while reading response header from upstream, client: it.hurts.when.IP.50, server: hostname, request: "DELETE /hub/api/users/haag/servers/adsf HTTP/1.1", upstream: "http://172.28.0.2:8000/hub/api/users/haag/servers/adsf", host: "hostname", referrer: "https://hostname/hub/home"
2021/04/13 14:10:11 [error] 33#33: *11 upstream prematurely closed connection while reading response header from upstream, client: it.hurts.when.IP.50, server: hostname, request: "DELETE /hub/api/users/haag/servers/dev HTTP/1.1", upstream: "http://172.28.0.2:8000/hub/api/users/haag/servers/dev", host: "hostname", referrer: "https://hostname/hub/home"
2021/04/13 14:10:30 [error] 33#33: *21 upstream prematurely closed connection while reading response header from upstream, client: it.hurts.when.IP.50, server: hostname, request: "POST /hub/login?next= HTTP/1.1", upstream: "http://172.28.0.2:8000/hub/login?next=", host: "hostname", referrer: "https://hostname/hub/login"
2021/04/13 14:10:47 [error] 33#33: *21 upstream prematurely closed connection while reading response header from upstream, client: it.hurts.when.IP.50, server: hostname, request: "POST /hub/login?next=%2Fhub%2F HTTP/1.1", upstream: "http://172.28.0.2:8000/hub/login?next=%2Fhub%2F", host: "hostname", referrer: "https://hostname/hub/login?next=%2Fhub%2F"
2021/04/13 14:11:38 [error] 30#30: *1 upstream prematurely closed connection while reading response header from upstream, client: it.hurts.when.IP.50, server: hostname, request: "POST /hub/login?next=%2Fhub%2F HTTP/1.1", upstream: "http://172.30.0.2:8000/hub/login?next=%2Fhub%2F", host: "hostname", referrer: "https://hostname/hub/login?next=%2Fhub%2F"

My problem was quiet simple and complex at the same time.

As I was using a defined image,

docker_notebook_image = os.environ[‘DOCKER_NOTEBOOK_IMAGE’] or ‘jupyter/minimal-notebook:4d9c9bd9ced0’
c.DockerSpawner.image = docker_notebook_image

where I installed additional packages and therefore needed to set

ENV http_proxy='http://proxy-host:1234/'
ENV https_proxy='http://proxy-host:1234/'

in the Dockerfile.

The solution was to add

ENV http_proxy=
ENV https_proxy=

at the end of the Dockerfile.

Nevertheless many thanks for you reply.

1 Like