After upgrading nginx from *1.18* to *1.24* we are getting following error:
upstream sent duplicate header line: "Transfer-Encoding: chunked", previous value: "Transfer-Encoding: chunked" while reading response header from upstream, client: 54.xx.xx.xx, server: backend.example.com, request: "POST /test/file HTTP/1.1", upstream: "http://10.0.xx.xx:6067/test/file", host: "backend.example.com", referrer: "https://app.example.com/
Nginx version: nginx/1.24.0
OS Version: Ubuntu 22.04.3 LTS
backend.conf
server {
access_log /var/log/nginx/access.log;
index index.html index.htm index.nginx-debian.html;
server_name backend.example.com;
include /etc/nginx/http_proxy.conf;
location /test/file {
proxy_pass http://10.0.xx.xx:6067/test/file;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $host:443;
}
listen 443 ssl;
ssl_certificate /etc/backend.example.com/fullchain.pem;
ssl_certificate_key /etc/backend.example.com/privkey.pem;
include /etc/options-ssl-nginx.conf;
ssl_dhparam /etc/ssl-dhparams.pem;
}
http_proxy.conf
proxy_buffers 32 4k;
proxy_http_version 1.1;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_set_header Connection '';
The request is successfully processed at the backend(spring-boot) but we are getting above error in error.log of backend Nginx which makes frontend fail with 502
If we remove `include /etc/nginx/http_proxy.conf;` from server block
We are getting following error:
upstream sent invalid chunked response while reading upstream, client: 54.xx.xx.xx,server: backend.example.com, request: "POST /test/file HTTP/1.1”, upstream: "http://10.0.xx.xx:6067/test/file", host: "backend.example.com”, referrer: "https://app.example.com/
Let me know if some other details are required
Any help or direction to solve this issue is appriciated.
Thanks in advance.