diff --git a/docker/decoder.conf.template b/docker/decoder.conf.template index 26280455c1466a74c2d676aa129742efc7a14e86..4efaa5fe7d8626d902a421aca0ac2439616b52b2 100644 --- a/docker/decoder.conf.template +++ b/docker/decoder.conf.template @@ -41,6 +41,27 @@ server { set $upstreamName frontend; proxy_pass http://$upstreamName; } + + location ^~ /jupyter-hub { + # "If the longest matching prefix location has the “^~” modifier then regular expressions are not checked." + + include /etc/nginx/cors.conf; + set $upstreamName jupyter-hub:8070; + proxy_pass http://$upstreamName; + + proxy_set_header Host $host; + + # update https://gitlab.ow2.org/decoder/reverse-proxy/issues/1 + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_http_version 1.1; + proxy_set_header X-Scheme $scheme; + proxy_set_header X-NginX-Proxy true; + proxy_hide_header Content-Security-Policy; + # end update https://gitlab.ow2.org/decoder/reverse-proxy/issues/1 + + proxy_hide_header X-Frame-Options; + } } server { @@ -67,75 +88,6 @@ server { proxy_pass http://$upstreamName; } - location ~ ^/jupyter-lab/(.*)$ { - # NOTE important to also set base url of jupyterhub to /jupyter in its config - set $upstreamName jupyter-lab:8888; - proxy_pass http://$upstreamName; - - proxy_redirect off; - # proxy_buffering off; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $host; - # websocket headers - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - #proxy_set_header Connection "upgrade"; - proxy_http_version 1.1; - proxy_set_header X-NginX-Proxy true; - proxy_hide_header Content-Security-Policy; - } - - location ^~ /jupyter-hub { - # "If the longest matching prefix location has the “^~” modifier then regular expressions are not checked." - # ie. The last location directive at the bottom wont be checked - include /etc/nginx/cors.conf; - set $upstreamName jupyter-hub:8070; - rewrite ^ $request_uri; # rewrite to full request uri, url-encoded. - rewrite ^/jupyter-hub(.*) /hub$1 break; # rewrite /jupyter-hub/foo/bar to /hub/foo/bar - return 400; # see /pkm location below for explanation - - proxy_set_header Host $host; - - # update https://gitlab.ow2.org/decoder/reverse-proxy/issues/1 - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - proxy_http_version 1.1; - proxy_set_header X-Scheme $scheme; - proxy_set_header X-NginX-Proxy true; - proxy_hide_header Content-Security-Policy; - # end update https://gitlab.ow2.org/decoder/reverse-proxy/issues/1 - - proxy_pass http://$upstreamName/$uri; - proxy_hide_header X-Frame-Options; - } - - location ^~ /hub { - include /etc/nginx/cors.conf; - proxy_set_header Host $host; - set $upstreamName jupyter-hub:8070; - rewrite ^ $request_uri; - rewrite ^/(hub.*) $1 break; - return 400; - - proxy_pass http://$upstreamName/$uri; - proxy_hide_header X-Frame-Options; - } - - location ^~ /user { - include /etc/nginx/cors.conf; - proxy_set_header Host $host; - set $upstreamName jupyter-hub:8070; - rewrite ^ $request_uri; - rewrite ^/(user.*) $1 break; - return 400; - - proxy_pass http://$upstreamName/$uri; - proxy_hide_header X-Frame-Options; - } - # the PKM is a special case among other tools because of special treatment like 'client_max_body_size' location ^~ /pkm/ { # https://stackoverflow.com/questions/28684300/nginx-pass-proxy-subdirectory-without-url-decoding/37584637#37584637