diff options
author | Vitaly Takmazov | 2024-06-11 00:36:28 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2024-06-11 00:36:28 +0300 |
commit | db3a8a109e35958a35210eaa359278c4374c76dd (patch) | |
tree | c735b5124d57b74b465183c218223c81b6726fca /src/main/java/com/juick/www | |
parent | f2e60f607dbd2a8ba6f3ca2b77ef918caa06b148 (diff) |
Add header for nginx to disable buffering on SSE endpoint
Diffstat (limited to 'src/main/java/com/juick/www')
-rw-r--r-- | src/main/java/com/juick/www/api/Service.java | 4 |
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); |