Deploying JupyterHub behind an Apache reverse proxy’s subdirectory

JupyterHub supports deployment behind a reverse proxy and even instructs how to do so behindnginx in its manual. I was unable to find documentation about how to do this serving the content from a reverse proxy subdirectory.

Since there’s been a long time since I worked as a sysadmin and, therefore, I tend to forget these things, here hoes my documentation, in the hopes it will be useful to someone else.

Let’s assume JupterHub is running in a machine whose IP is and, since it is being proxied, the --no-ssl command was used. Let’s also assume the Apache proxy serves its content at

<IfModule mod_proxy.c>
    Redirect /jupyter /jupyter/
    ProxyVia On
    ProxyRequests Off
    ProxyPass /jupyter/
    ProxyPassReverse /jupyter/
    ProxyPreserveHost on
    Header edit Origin ""
    RequestHeader edit Origin ""
    Header edit Referrer ""
    RequestHeader edit Referrer ""
    <Proxy *>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    <Location ~ "/jupyter/(user/[^/]*)/(api/kernels/[^/]+/channels|terminals/websocket)/?">
        ProxyPass ws://
        ProxyPassReverse ws://
You will need the mod_proxy_wstunnel module.
Renato Luiz de Freitas Cunha
Principal Research Software Engineer

My research interests include reinforcement learning and distributed systems