diff --git a/nginx/templates/default.conf.template b/nginx/templates/default.conf.template index dc599d6072ed8166c4e309f22a1218ad5746141b..aaf562399095ece2561bea86f2dc1ae4f577886e 100644 --- a/nginx/templates/default.conf.template +++ b/nginx/templates/default.conf.template @@ -78,7 +78,7 @@ server { set $prerender 0; } # resolver is needed by nginx to resolve proxy_pass url with variable (https://stackoverflow.com/questions/57937222/502-bad-gateway-nginx-no-resolver-defined-to-resolve ) - resolver dns-default.openshift-dns.svc.cluster.local; + resolver dns-default.openshift-dns.svc.cluster.local; if ($prerender = 1) { # Add $request_uri to avoid error nginx: [emerg] "proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or inside "limit_except" # (proxy_pass in if clause is not recommanded, but don't kwnow other way in our case to redirect to a backend ; cf. https://www.f5.com/fr_fr/company/blog/nginx/avoiding-top-10-nginx-configuration-mistakes#if , https://stackoverflow.com/a/10634915 ) @@ -90,6 +90,23 @@ server { try_files $uri $uri/ /index.html; } + ## SSE conf + location /api/notification/stream { + add_header X-Debug-SSE-Config Active; # debug + proxy_pass http://res-server-service:3000; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header Connection ''; + proxy_buffering off; + proxy_cache off; + proxy_read_timeout 3600s; + proxy_send_timeout 3600s; + gzip off; + chunked_transfer_encoding on; + add_header Cache-Control no-cache; + add_header Content-Type text/event-stream; + } + location /api { proxy_pass http://res-server-service:3000; }