Troubleshoot 502 Bad Gateway

Problem

I'm using nginx and the error log is showing the following message:


[error] 6890#0: *15355 upstream sent too big header while reading response header from upstream,
    client: 203.0.113.2, server: subdomain.example.com,
    request: "POST /en/install/step4 HTTP/2.0",
    upstream: "https://subdomain.example.com:7081/en/install/step4",
    host: "subdomain.example.com",
    referrer: "https://subdomain.example.com/en/install/step3"

Cause

A request cannot be processed by the proxy server because of insufficient buffer size.

Resolution

To increase the buffer size follow the steps below:

  1. Increase 'buffers" and 'buffer_size' in /etc/nginx/nginx.conf under http { section. For example:
    proxy_buffers 8 16k;
    proxy_buffer_size 32k;
    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;
  2. Restart nginx service