upstream sent too big header while reading response header from upstream, client: 124.127.32.1, server: ra.nerc-edu.com
授权平台用户登录后报Nginx错误。
查看Nginx错误日志报错如下:
从上游读取响应头时上游发送的响应头过大
2021/08/18 09:27:10 [error] 6886#6886: *37668803 upstream sent too big header while reading response header from upstream, client: 124.127.32.1, server: ra.nerc-edu.com, request: "POST /signin-oidc HTTP/1.1", upstream: "http://172.17.136.237:80/signin-oidc", host: "ra.nerc-edu.com"
2021/08/18 09:33:56 [error] 6886#6886: *37677775 upstream sent too big header while reading response header from upstream, client: 124.127.32.1, server: ra.nerc-edu.com, request: "POST /signin-oidc HTTP/1.1", upstream: "http://172.17.136.237:80/signin-oidc", host: "ra.nerc-edu.com"
2021/08/18 09:34:03 [error] 6886#6886: *37677777 upstream sent too big header while reading response header from upstream, client: 124.127.32.1, server: ra.nerc-edu.com, request: "POST /signin-oidc HTTP/1.1", upstream: "http://172.17.136.237:80/signin-oidc", host: "ra.nerc-edu.com"
2021/08/18 09:43:56 [error] 6886#6886: *37691299 upstream sent too big header while reading response header from upstream, client: 124.127.32.1, server: ra.nerc-edu.com, request: "POST /signin-oidc HTTP/1.1", upstream: "http://172.17.136.237:80/signin-oidc", host: "ra.nerc-edu.com"
2021/08/18 09:44:31 [error] 6886#6886: *37691298 upstream sent too big header while reading response header from upstream, client: 124.127.32.1, server: ra.nerc-edu.com, request: "POST /signin-oidc HTTP/1.1", upstream: "http://172.17.136.237:80/signin-oidc", host: "ra.nerc-edu.com"
2021/08/18 09:44:51 [error] 6886#6886: *37692076 upstream sent too big header while reading response header from upstream, client: 124.127.32.1, server: ra.nerc-edu.com, request: "POST /signin-oidc HTTP/1.1", upstream: "http://172.17.136.237:80/signin-oidc", host: "ra.nerc-edu.com"
2021/08/18 09:45:19 [error] 6886#6886: *37692594 upstream sent too big header while reading response header from upstream, client: 124.127.32.1, server: ra.nerc-edu.com, request: "POST /signin-oidc HTTP/1.1", upstream: "http://172.17.136.237:80/signin-oidc", host: "ra.nerc-edu.com"
2021/08/18 09:47:30 [error] 22378#22378: *37694856 upstream sent too big header while reading response header from upstream, client: 124.127.32.1, server: ra.nerc-edu.com, request: "POST /signin-oidc HTTP/1.1", upstream: "http://172.17.136.237:80/signin-oidc", host: "ra.nerc-edu.com"
查看Nginx配置文件信息如下:
server {
listen 80;
server_name ra.nerc-edu.com;
location / {
proxy_pass http://172.17.136.237;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#Proxy Settings
proxy_redirect off;
proxy_set_header Connection close;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_max_temp_file_size 0;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
将其中的proxy_buffer_size 4k;
调整到8k proxy_buffer_size 8k;
后测试正常。