Add locations

Add script and /api/ locations to support hugo analytics
TASK: Secure access e.g private network URL for admin page; restrict public pages
This commit is contained in:
2026-03-14 15:32:43 +00:00
parent 53b212e5b0
commit 7b36b99e18

View File

@@ -86,6 +86,39 @@ server {
proxy_set_header Referer $http_referer; proxy_set_header Referer $http_referer;
proxy_redirect off; proxy_redirect off;
proxy_set_header Cookie $http_cookie;
}
# 1. Allow public access to tracking scripts
location ~ ^/(script\.js|umami\.js)$ {
proxy_pass http://$umami_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https; # $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_buffering off;
proxy_set_header Referer $http_referer;
proxy_redirect off;
proxy_set_header Cookie $http_cookie;
}
# 2. Allow public access to tracking API (metrics collection)
location /api/send {
proxy_pass http://$umami_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https; # $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_buffering off;
proxy_set_header Referer $http_referer;
proxy_redirect off;
proxy_set_header Cookie $http_cookie; proxy_set_header Cookie $http_cookie;
} }
} }