diff --git a/deploy/check.nginx.conf b/deploy/check.nginx.conf new file mode 100644 index 0000000..2bebbe7 --- /dev/null +++ b/deploy/check.nginx.conf @@ -0,0 +1,39 @@ +# nginx location for hoelee-check — to be added to the www.hoelee.com server block on unRaid +# (container nginx-www-hoelee). Not applied yet. +# +# Two properties matter more than anything else here: +# 1. `^~ /check/` wins over the static-extension regex, so /check/report/hoelee.com is proxied +# instead of being treated as a file named "hoelee.com". +# 2. `access_log off;` — an access log of /check/report/ IS the query log the site +# promises not to keep. Without this line the promise is false. +# +# proxy_pass has no URI part, so the service receives the full /check/... path it expects. + +location ^~ /check/ { + access_log off; + + proxy_pass http://hoelee-check:3000; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_connect_timeout 5s; + proxy_send_timeout 25s; + proxy_read_timeout 25s; + + # Report pages set X-Robots-Tag themselves; keep nginx from buffering a slow report behind + # a full response. + proxy_buffering on; + proxy_buffers 8 16k; +} + +# Smoke tests after adding this (from any machine): +# curl -sS -o /dev/null -w '%{http_code}\n' https://www.hoelee.com/check/ +# curl -sS https://www.hoelee.com/check/api/health +# curl -sS -o /dev/null -w '%{http_code}\n' https://www.hoelee.com/check/report/hoelee.com +# curl -sSI https://www.hoelee.com/check/report/hoelee.com | grep -i x-robots-tag # noindex +# curl -sS -o /dev/null -w '%{http_code}\n' 'https://www.hoelee.com/check/?d=127.0.0.1' # 400 +# for i in $(seq 1 12); do curl -s -o /dev/null -w '%{http_code} ' \ +# 'https://www.hoelee.com/check/report/example.com?fresh=1'; done # ends in 429 +# # and afterwards: confirm nothing appeared in the nginx access log for /check/