server sent events - Nginx cuts off data and does not use Transfer-Encoding: chunked - Stack Overflow

I use nginx to proxy requests to the Server Sent Events API. Without nginx everything works fine, but w

I use nginx to proxy requests to the Server Sent Events API. Without nginx everything works fine, but when proxying through nginx the event body is cut off and further events do not arrive.

Nginx replaces the "Transfer-Encoding: chunked" header with "Content-Length". Nginx runs in the jwilder/nginx-proxy Docker image, if that matters.

I have already tried everything that is commented out and it does not work:

   #gzip on; 
   #gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json; 


server { 
 listen 80; 
 listen [::]:80; 
 server_name localhost; 
 #chunked_transfer_encoding on; 

 location /api { 
    proxy_pass http://localhost:8080/api;
 
    #proxy_set_header Transfer-Encoding "chunked"; 
    #proxy_http_version 1.1;
    #proxy_set_header Host $host;
    #proxy_set_header X-Real-IP $remote_addr;
    #proxy_set_header Connection "";
    #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    #proxy_set_header X-Accel-Buffering "no";
    #proxy_set_header Content-Type "text/event-stream";
    #proxy_set_header Cache-Control "no-cache";
    #proxy_buffering off;
    #proxy_request_buffering off;
    #proxy_pass_request_headers on;
    #chunked_transfer_encoding off; #also tried "on"
    #proxy_cache off;
    #proxy_set_header TestHeader "testHeaderValue";   
    #keepalive_timeout 65;
    #add_header Cache-Control no-cache; 
}
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744756552a4591917.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信