upstream example_sse_backend {
    server 127.0.0.1:8082;
    keepalive 32;
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name events.example.com;

    include /etc/nginx/snippets/tls-example.conf;
    include /etc/nginx/snippets/security-headers.conf;
    include /etc/nginx/snippets/hsts.conf;

    location /events {
        proxy_pass http://example_sse_backend;
        include /etc/nginx/snippets/proxy-common.conf;
        proxy_buffering off;
        proxy_cache off;
        proxy_read_timeout 1h;
        add_header X-Accel-Buffering "no" always;
        include /etc/nginx/snippets/security-headers.conf;
    }
}
