# Serves the built SPA and proxies /api to the backend in the same container. # Rendered by the nginx image's envsubst step into /etc/nginx/conf.d/default.conf. server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # The SPA handles the API itself; don't announce the server version. server_tokens off; # SPA fallback: unknown paths render the app, so client-side routes like # /rooms/daily-standup work on refresh and deep links. location / { try_files $uri $uri/ /index.html; } location = /index.html { add_header Cache-Control "no-store"; } # Proxy the API to the Go backend running alongside nginx. # # X-Forwarded-For is set to $remote_addr (the peer nginx actually saw), NOT # $proxy_add_x_forwarded_for. The latter appends to any client-supplied # header, which would let a client spoof its own IP since the backend trusts # the leftmost value. If you deploy behind another trusted proxy, switch to # $proxy_add_x_forwarded_for and make the backend read the correct hop. location /api/ { proxy_pass http://${BACKEND_HOST}:${BACKEND_PORT}; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; } }