changeset 1742:d778f1f2598a

make server side events proxy work
author Vadim Filimonov <fffilimonov@yandex.ru>
date Tue, 08 Nov 2022 09:32:46 +0200
parents 623d9f62ab92
children 792268dce5ec
files host/startup/nginx/nginx.default.conf.luan src/goodjava/webserver/ServerSentEvents.java
diffstat 2 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/host/startup/nginx/nginx.default.conf.luan	Fri Nov 04 10:03:12 2022 -0600
+++ b/host/startup/nginx/nginx.default.conf.luan	Tue Nov 08 09:32:46 2022 +0200
@@ -5,6 +5,8 @@
 
 	proxy_http_version 1.1;
 	proxy_set_header Host $http_host;
+	proxy_set_header Connection '';
+
 	error_log <%=rootDir%>/logs/nginx_error.log;
 
 	proxy_set_header X-Forwarded-Proto $scheme;
@@ -18,6 +20,7 @@
 	}
 
 	location ~ /(?<path>.*) {
+		chunked_transfer_encoding off;
 		proxy_cache_key $scheme$host$request_uri;
 		proxy_cache nginx_cache;
 		proxy_cache_revalidate on;
--- a/src/goodjava/webserver/ServerSentEvents.java	Fri Nov 04 10:03:12 2022 -0600
+++ b/src/goodjava/webserver/ServerSentEvents.java	Tue Nov 08 09:32:46 2022 +0200
@@ -74,6 +74,7 @@
 		writer.write("Access-Control-Allow-Origin: *\r\n");
 		writer.write("Cache-Control: no-cache\r\n");
 		writer.write("Content-Type: text/event-stream\r\n");
+		writer.write("X-Accel-Buffering: no\r\n");
 		writer.write("\r\n");
 		writer.flush();