ty793941 commented on issue #4162:
URL: https://github.com/apache/apisix/issues/4162#issuecomment-1120937745
I have solved this problem。**Please look at here!**
### Error Info:
`2022/05/08 14:24:31 [error] 47#47: *6887749 upstream sent too big header
while reading response header from upstream, client: xxx.xxx.xxx.xxx, server:
_, request: "POST /signin-oidc HTTP/1.1", upstream:
"http://xx.xx.xxx.xxxx:xxxx/signin-oidc", host: "xs.xxxxxxx.com:9080"`
The problem I have is that the response size is 5kb,bigger than
**proxy_buffer_size** size,which default is 4kb. This leads to API SIX
reporting 502 error.
**proxy_buffer_size:**
Nginx uses proxy_ buffer_ Size request corresponding read_ BUF, which
specifies the maximum length of the upstream header. If the response header
exceeds this length, nginx will report the error of upstream sent too big
header.
### Solution:
change the nginx proxy_buffer_size size to the right size.
I got the nginx config from apisix doc.
https://github.com/apache/apisix/blob/master/docs/en/latest/customize-nginx-configuration.md
`The Nginx configuration used by APISIX is generated via the template file
apisix/cli/ngx_tpl.lua and the options from conf/config-default.yaml
/conf/config.yaml.`
so we modify the /conf/config.yaml,and add the some snippets,like this:
```
nginx_config: # config for render the template to
generate nginx.conf
http_configuration_snippet: |
proxy_buffer_size 128k;
proxy_buffers 32 128k;
proxy_busy_buffers_size 128k;
http_server_configuration_snippet: |
proxy_buffer_size 128k;
proxy_buffers 32 128k;
proxy_busy_buffers_size 128k;
```
The http_configuration_snippet and http_server_configuration_snippet will
attach to the nginx.conf,which the options from conf/config-default.yaml and
/conf/config.yaml.
If you want to learn more about how the http_configuration_snippet and
http_server_configuration_snippet works,look at
https://github.com/apache/apisix/blob/master/conf/config-default.yaml ,and
find the snippets.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]