From 96fc9dc408571e61335924be5d7c13bce496237e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Ja=C3=A9n=20G=C3=B3mez?= Date: Mon, 6 Dec 2021 16:50:18 +0000 Subject: [PATCH 1/6] Update decoder.conf.template --- docker/decoder.conf.template | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/decoder.conf.template b/docker/decoder.conf.template index 2628045..75d2ed1 100644 --- a/docker/decoder.conf.template +++ b/docker/decoder.conf.template @@ -94,7 +94,7 @@ server { 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 + rewrite ^/jupyter-hub(.*) /jupyter-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; @@ -110,6 +110,8 @@ server { proxy_pass http://$upstreamName/$uri; proxy_hide_header X-Frame-Options; + proxy_hide_header Content-Security-Policy; + } location ^~ /hub { -- GitLab From 9f9c28857d9f40812330414e55ca2e43df14471e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Ja=C3=A9n=20G=C3=B3mez?= Date: Mon, 6 Dec 2021 20:37:30 +0000 Subject: [PATCH 2/6] Update decoder.conf.template --- docker/decoder.conf.template | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/decoder.conf.template b/docker/decoder.conf.template index 75d2ed1..9fb84af 100644 --- a/docker/decoder.conf.template +++ b/docker/decoder.conf.template @@ -110,7 +110,6 @@ server { proxy_pass http://$upstreamName/$uri; proxy_hide_header X-Frame-Options; - proxy_hide_header Content-Security-Policy; } -- GitLab From 2af0e11ec12d84423c7e3f05d916e16e6bb8ac86 Mon Sep 17 00:00:00 2001 From: Martin Hamant Date: Tue, 7 Dec 2021 10:22:16 +0100 Subject: [PATCH 3/6] suggestion to simplify the config --- docker/decoder.conf.template | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docker/decoder.conf.template b/docker/decoder.conf.template index 9fb84af..0571df9 100644 --- a/docker/decoder.conf.template +++ b/docker/decoder.conf.template @@ -91,11 +91,10 @@ server { 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(.*) /jupyter-hub$1 break; # rewrite /jupyter-hub/foo/bar to /hub/foo/bar - return 400; # see /pkm location below for explanation + proxy_pass http://$upstreamName; proxy_set_header Host $host; @@ -108,9 +107,7 @@ server { 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 { -- GitLab From b7cdf8a283fdae6d056a1a8d3035a3eecd51df1c Mon Sep 17 00:00:00 2001 From: Martin Hamant Date: Fri, 10 Dec 2021 10:09:58 +0100 Subject: [PATCH 4/6] moving /jupyter-hub to the frontend vhost --- docker/decoder.conf.template | 89 ++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/docker/decoder.conf.template b/docker/decoder.conf.template index 0571df9..e3d2d24 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 { @@ -88,51 +109,29 @@ server { 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; - 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; - } - - 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; - } + # 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/ { -- GitLab From 5dc04a262fa879a36e3dcfed6542263a3aa05f73 Mon Sep 17 00:00:00 2001 From: Martin Hamant Date: Wed, 15 Dec 2021 12:06:48 +0100 Subject: [PATCH 5/6] removing /hub and /user references in decoder-tool --- docker/decoder.conf.template | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/docker/decoder.conf.template b/docker/decoder.conf.template index e3d2d24..dc20a3a 100644 --- a/docker/decoder.conf.template +++ b/docker/decoder.conf.template @@ -89,7 +89,8 @@ server { } location ~ ^/jupyter-lab/(.*)$ { - # NOTE important to also set base url of jupyterhub to /jupyter in its config + # TO BE DELETED SOON in favor to jupyter-hub (Miguel) + # NOTE important to also set base url of jupyterlab to /jupyter-lab in its config set $upstreamName jupyter-lab:8888; proxy_pass http://$upstreamName; @@ -109,30 +110,6 @@ server { proxy_hide_header Content-Security-Policy; } - # 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 -- GitLab From 017ee133a1ca0577743a1e631f4efce429b8287e Mon Sep 17 00:00:00 2001 From: Martin Hamant Date: Thu, 16 Dec 2021 08:53:55 +0100 Subject: [PATCH 6/6] removing reference to jupyter-lab (#1,!1) --- docker/decoder.conf.template | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/docker/decoder.conf.template b/docker/decoder.conf.template index dc20a3a..4efaa5f 100644 --- a/docker/decoder.conf.template +++ b/docker/decoder.conf.template @@ -88,28 +88,6 @@ server { proxy_pass http://$upstreamName; } - location ~ ^/jupyter-lab/(.*)$ { - # TO BE DELETED SOON in favor to jupyter-hub (Miguel) - # NOTE important to also set base url of jupyterlab to /jupyter-lab 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; - } - # 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 -- GitLab