mirror of
				https://github.com/ohwgiles/laminar.git
				synced 2025-06-13 12:54:29 +00:00 
			
		
		
		
	sse endpoint: hint to reverse-proxy not to buffer
Similarly to 210787a3, and as discussed in #88 and #130, nginx
will buffer chunked transfer-encoding unless proxy_buffering
is turned off or the X-Accel-Buffering header is set to no.
resolves #130
			
			
This commit is contained in:
		
							parent
							
								
									8a4992e6af
								
							
						
					
					
						commit
						4316eb8a00
					
				| @ -203,6 +203,8 @@ kj::Promise<void> Http::request(kj::HttpMethod method, kj::StringPtr url, const | ||||
|     if(is_sse) { | ||||
|         KJ_IF_MAYBE(s, fromUrl(url.cStr(), queryString)) { | ||||
|             responseHeaders.set(kj::HttpHeaderId::CONTENT_TYPE, "text/event-stream"); | ||||
|             // Disables nginx reverse-proxy's buffering. Necessary for streamed events.
 | ||||
|             responseHeaders.add("X-Accel-Buffering", "no"); | ||||
|             auto peer = kj::heap<WithSetRef<EventPeer>>(eventPeers); | ||||
|             peer->scope = *s; | ||||
|             std::string st = "data: " + laminar.getStatus(peer->scope) + "\n\n"; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user