# 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. # # This nginx normally sits behind a parent (SSL-terminating) proxy, so the # parent has already resolved the real client IP into X-Forwarded-For. # Appending with $proxy_add_x_forwarded_for preserves that first entry, which # is what the backend reads (auth.ExtractIP uses the leftmost value). # Do NOT use $remote_addr here: it would replace the parent's header with the # parent's own address (e.g. the Docker bridge gateway 172.20.0.1). 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 $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }