|
|
Posted on28 seconds ago
|
|
|

Requirement: When using nginx reverse proxy to access the website, occasional 502 errors were reported, always because the backend was down or network fluctuations. Eventually, checking the nginx error logs revealed other reasons.
There are actually many causes of nginx 502 errors. When a 502 Bad Gateway server has an error and acts as a proxy or gateway, your server may not receive the correct upstream response when trying to process the request.
nginx error log:
*753983 upstream sent too big header while reading response header from upstream, client: xxx, server: test-sso.rms-cloud.com, request: "GET /itsvse HTTP/2.0", upstream: "http://127.0.0.1:29090/itsvse", host: "xxx.com"
Solution:
nginx adds the following configuration:
Configuration Description:
proxy_buffer_size
Syntax: proxy_buffer_size size;
Default: proxy_buffer_size 4k|8k;
Context: http, server, location
Set the buffer size for reading the first part of the response received from the proxy server. This part usually contains a small response header; If the buffer size is exceeded, the response is considered invalid. By default, the buffer size equals one memory page. This is 4K or 8K, depending on the platform. However, it can be made smaller.
proxy_buffers
Syntax: proxy_buffers number size;
Default: proxy_buffers 8 4k|8k;
Context: http, server, location
Set the number and size of buffers for a single connection to read responses from the proxy server. By default, the buffer size equals one memory page. This is 4K or 8K, depending on the platform.
proxy_busy_buffers_size
Syntax: proxy_busy_buffers_size size;
Default: proxy_busy_buffers_size 8k|16k;
Context: http, server, location
When response buffering from the proxy server is enabled, the total size of the buffers that may be busy sending responses to clients before the response is fully read is limited. Meanwhile, the remaining buffers can be used to read responses and buffer part of the response into temporary files as needed. By default, the size is limited by the size of the two buffers set by the proxy_buffer_size and proxy_bBuffers instructions. |
Previous:Introduction to network communication eSIM, EID, and eUICC
|