We have tomcat with Jersey serving APIs behind NGINX. A new streaming API we have developed worked great when we call Tomcat directly, but started getting no response when calling it through NGINX.
Looking at NGINX logs we got:
upstream sent invalid chunked response while reading upstream
We have solved the issue by adding the following to NGINX:
proxy_http_version 1.1
I guess NGINX proxies traffic by default with http version 1.0, but chunked transfer encoding is a http 1.1 feature.
https://forum.nginx.org/read.php?2,247883,247906#msg-247906
In my case, only setting proxy_http_version 1.1 did not work. I had to set these -
proxy_http_version 1.1;
proxy_set_header Connection "";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With