문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
springframework:httpstream [2022/01/04 14:03] kwon37xi [Reverse Proxy(nginx) 설정] |
springframework:httpstream [2022/01/04 17:00] (현재) kwon37xi [ServerSentEvent Reverse Proxy(nginx) 설정] |
||
|---|---|---|---|
| 줄 3: | 줄 3: | ||
| * [[springframework: | * [[springframework: | ||
| - | ===== Reverse Proxy(nginx) 설정 ===== | + | ===== ServerSentEvent |
| + | * [[: | ||
| + | |||
| * [[https:// | * [[https:// | ||
| - | * [[https://stackoverflow.com/questions/13672743/ | + | * [[https://github.com/wandenberg/nginx-push-stream-module|wandenberg/nginx-push-stream-module: |
| * 서버측에서 '' | * 서버측에서 '' | ||
| - | * 아니면 nginx 의 SSE 관련 url 프록시에 대해서만 '' | + | * [[https:// |
| + | <code java> | ||
| + | @RequestMapping("/ | ||
| + | public SseEmitter getRealTimeJudgeResultAction(HttpServletResponse response) throws IOException { | ||
| + | // .... | ||
| + | response.addHeader(" | ||
| + | SseEmitter sseEmitter = new SseEmitter(); | ||
| + | // .... | ||
| + | sseEmitter.send(" | ||
| + | return sseEmitter; | ||
| + | } | ||
| + | </ | ||
| + | < | ||
| + | # 응답 결과를 보면 X-Accel-Buffering: | ||
| + | curl -D - http:// | ||
| + | HTTP/1.1 200 | ||
| + | X-Accel-Buffering: | ||
| + | Content-Type: | ||
| + | Transfer-Encoding: | ||
| + | ... | ||
| + | </ | ||
| + | * nginx 의 SSE 관련 url 프록시에 대해서만 '' | ||
| + | * [[https:// | ||
| < | < | ||
| location / | location / | ||
| - | proxy_pass http://chat_dev_upstream; | + | proxy_pass http://upstream; |
| - | proxy_buffering off; | + | proxy_buffering off; # X-Accel-Buffering: |
| proxy_cache off; | proxy_cache off; | ||
| proxy_set_header Host $host; | proxy_set_header Host $host; | ||
| 줄 19: | 줄 45: | ||
| } | } | ||
| </ | </ | ||
| + | * [[https:// | ||
| ===== 참고 ===== | ===== 참고 ===== | ||
| * [[https:// | * [[https:// | ||