From 84d31fed001b4e2f83703973191f3d52e61d33c7 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Fri, 9 Jul 2021 13:58:55 +0200 Subject: [PATCH 1/3] increase timeouts on nginx locations that proxy pass internally --- docker/nginx/conf.d/client.conf | 7 +++++++ docker/nginx/conf.d/include/proxy-pass-internal | 10 ++++++++++ 2 files changed, 17 insertions(+) create mode 100644 docker/nginx/conf.d/include/proxy-pass-internal diff --git a/docker/nginx/conf.d/client.conf b/docker/nginx/conf.d/client.conf index 123516fb..96304431 100644 --- a/docker/nginx/conf.d/client.conf +++ b/docker/nginx/conf.d/client.conf @@ -142,6 +142,7 @@ server { location /hns { include /etc/nginx/conf.d/include/proxy-buffer; + include /etc/nginx/conf.d/include/proxy-pass-internal; # variable definititions - we need to define a variable to be able to access it in lua by ngx.var.something set $skylink ''; # placeholder for the raw 46 bit skylink @@ -244,6 +245,8 @@ server { # it is not suitable for every registry call but some requests might be cached # and we are using it currently for caching registry resolutions from /hns calls location /skynet/registry/cached { + include /etc/nginx/conf.d/include/proxy-pass-internal; + internal; # internal endpoint only access_log off; # do not log traffic @@ -460,6 +463,7 @@ server { location @dnslink_lookup { include /etc/nginx/conf.d/include/proxy-buffer; + include /etc/nginx/conf.d/include/proxy-pass-internal; set $dnslink ''; @@ -485,12 +489,14 @@ server { location @base32_subdomain { include /etc/nginx/conf.d/include/proxy-buffer; + include /etc/nginx/conf.d/include/proxy-pass-internal; proxy_pass http://127.0.0.1/$base32_subdomain/$request_uri; } location @hns_domain { include /etc/nginx/conf.d/include/proxy-buffer; + include /etc/nginx/conf.d/include/proxy-pass-internal; proxy_pass http://127.0.0.1/hns/$hns_domain/$request_uri; } @@ -508,6 +514,7 @@ server { location ~ "^/file/([a-zA-Z0-9-_]{46}(/.*)?)$" { include /etc/nginx/conf.d/include/proxy-buffer; + include /etc/nginx/conf.d/include/proxy-pass-internal; rewrite /file/(.*) $1 break; # drop the /file/ prefix from uri diff --git a/docker/nginx/conf.d/include/proxy-pass-internal b/docker/nginx/conf.d/include/proxy-pass-internal new file mode 100644 index 00000000..2c17de5e --- /dev/null +++ b/docker/nginx/conf.d/include/proxy-pass-internal @@ -0,0 +1,10 @@ +# ---------------------------------------------------------------- +# this file should be included on all locations that proxy_pass to +# another nginx location - internal nginx traffic +# ---------------------------------------------------------------- + +# increase the timeout on internal nginx proxy_pass locations to a +# value that is significantly higher than expected and let the end +# location handle correct timeout +proxy_read_timeout 30m; +proxy_send_timeout 30m; \ No newline at end of file From 191d97b2c230e07fcc148a2c3b7daeb1b52430c0 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Fri, 9 Jul 2021 13:59:31 +0200 Subject: [PATCH 2/3] already contains leading slash --- docker/nginx/conf.d/client.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/nginx/conf.d/client.conf b/docker/nginx/conf.d/client.conf index 96304431..1ace7f7b 100644 --- a/docker/nginx/conf.d/client.conf +++ b/docker/nginx/conf.d/client.conf @@ -484,21 +484,21 @@ server { } proxy_set_header Dnslink-Lookup ""; - proxy_pass http://127.0.0.1/$dnslink/$request_uri; + proxy_pass http://127.0.0.1/$dnslink$request_uri; } location @base32_subdomain { include /etc/nginx/conf.d/include/proxy-buffer; include /etc/nginx/conf.d/include/proxy-pass-internal; - proxy_pass http://127.0.0.1/$base32_subdomain/$request_uri; + proxy_pass http://127.0.0.1/$base32_subdomain$request_uri; } location @hns_domain { include /etc/nginx/conf.d/include/proxy-buffer; include /etc/nginx/conf.d/include/proxy-pass-internal; - proxy_pass http://127.0.0.1/hns/$hns_domain/$request_uri; + proxy_pass http://127.0.0.1/hns/$hns_domain$request_uri; } location @purge { From 3b026b4c593bd57eeb4298434ce8a4c76833d7e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Wypch=C5=82o?= Date: Fri, 9 Jul 2021 14:45:46 +0200 Subject: [PATCH 3/3] add missing new line --- docker/nginx/conf.d/include/proxy-pass-internal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/nginx/conf.d/include/proxy-pass-internal b/docker/nginx/conf.d/include/proxy-pass-internal index 2c17de5e..c41f33bc 100644 --- a/docker/nginx/conf.d/include/proxy-pass-internal +++ b/docker/nginx/conf.d/include/proxy-pass-internal @@ -7,4 +7,4 @@ # value that is significantly higher than expected and let the end # location handle correct timeout proxy_read_timeout 30m; -proxy_send_timeout 30m; \ No newline at end of file +proxy_send_timeout 30m;