最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin1浏览0评论

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; 
}
}
发布评论

评论列表(0)

  1. 暂无评论