# Behind the TLS edge proxy the client's scheme arrives in X-Forwarded-Proto # (deploy/edge). Keep it when it is https so the backend sees the original # scheme; every other value falls back to the scheme of this server. The # header is trustworthy only because the frontend port is published on # loopback or on the tunnel address, never on a public one. map $http_x_forwarded_proto $forwarded_proto { default $scheme; https https; } server { listen 8080; server_name _; root /usr/share/nginx/html; index index.html; add_header X-Content-Type-Options nosniff always; add_header Referrer-Policy strict-origin-when-cross-origin always; add_header X-Frame-Options DENY always; add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always; location = /healthz { access_log off; default_type text/plain; return 200 "ok\n"; } location = /api { return 404; } location ^~ /api/ { proxy_pass http://backend:8080; proxy_http_version 1.1; 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 $forwarded_proto; proxy_set_header X-Request-ID $request_id; proxy_connect_timeout 3s; proxy_send_timeout 30s; proxy_read_timeout 30s; } location = /telemetry { limit_req zone=telemetry_rate burst=10 nodelay; client_max_body_size 1m; set $faro_receiver faro-receiver:12347; proxy_pass http://$faro_receiver/collect; proxy_http_version 1.1; 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 $forwarded_proto; proxy_connect_timeout 2s; proxy_send_timeout 5s; proxy_read_timeout 5s; } location / { try_files $uri $uri/ /index.html; } }