aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2024-06-11 00:36:28 +0300
committerGravatar Vitaly Takmazov2024-06-11 00:36:28 +0300
commitdb3a8a109e35958a35210eaa359278c4374c76dd (patch)
treec735b5124d57b74b465183c218223c81b6726fca /src/main
parentf2e60f607dbd2a8ba6f3ca2b77ef918caa06b148 (diff)
Add header for nginx to disable buffering on SSE endpoint
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/juick/www/api/Service.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/com/juick/www/api/Service.java b/src/main/java/com/juick/www/api/Service.java
index 310f1285..ed6699d2 100644
--- a/src/main/java/com/juick/www/api/Service.java
+++ b/src/main/java/com/juick/www/api/Service.java
@@ -37,6 +37,7 @@ import jakarta.mail.internet.AddressException;
import jakarta.mail.internet.InternetAddress;
import jakarta.mail.internet.MimeMessage;
+import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomStringUtils;
@@ -221,7 +222,8 @@ public class Service {
}
@GetMapping("/api/events")
- public SseEmitter handle(@Parameter(hidden = true) User visitor) {
+ public SseEmitter handle(@Parameter(hidden = true) User visitor, HttpServletResponse response) {
+ response.addHeader("X-Accel-Buffering", "no");
logger.info("{} connected", visitor.getName());
if (!visitor.isAnonymous()) {
userService.updateLastSeen(visitor);