Files
buzz/nginx/nginx.conf
T

57 lines
1.4 KiB
Nginx Configuration File
Executable File

events {}
http {
# 1 = log, 0 = don't log (based on path)
map $uri $loggable_uri {
default 1;
~^/_next 0;
=/favicon.webp 0;
=/robots.txt 0;
=/api/auth/get-session 0;
=/monitoring 0;
~^/api/.*/count$ 0;
=/api/health 0;
}
# 1 = log, 0 = don't log (based on header)
map $http_rsc $loggable_prefetch {
default 1;
"" 1; # header not present
~.+ 0; # header exists (any value)
}
# final decision: log only if BOTH say yes
map "$loggable_uri:$loggable_prefetch" $loggable {
default 0;
"1:1" 1;
}
log_format clean ' $request_method $uri $status';
access_log /var/log/nginx/access.log clean if=$loggable;
upstream backend {
server app:3000;
}
server {
listen 80;
resolver 127.0.0.11 valid=5s ipv6=off;
location / {
proxy_pass http://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 $scheme;
# SSE SETUP
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
proxy_read_timeout 200s;
}
}
client_max_body_size 100M;
}