# Include in http {}. Configure TLS before exposing this site to the internet. server { listen 80; server_name events.example; location = /events { proxy_pass http://127.0.0.1:8082; proxy_http_version 1.1; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Forwarded ""; proxy_buffering off; proxy_cache off; gzip off; # The upstream emits text/event-stream and sends periodic heartbeats. proxy_read_timeout 75s; } location / { return 404; } }