Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

eddieace's avatar

Wordpress on forge upstream sent too big header while reading response header from upstream

Hi I have a wordpress site running on forge. I get this error.

502 Bad Gateway

From log:

017/03/07 09:40:30 [error] 12586#12586: *13909 upstream sent too big header while reading response header from upstream, client: 46.59.124.52, server: example.com, request: "GET /wp-admin/post.php?post=123&action=edit HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.1-fpm.sock:", host: "example.com", referrer: "http://ecample.com/wp-admin/edit.php?post_type=page&orderby=title&order=asc"

Online I have found a few solutions.

The first one is this but the problem is that I don't know where to add it. I have tried both in etc/nginx/nginx.conf and in the location block in sites-available.

fastcgi_buffers 16 16k; 
fastcgi_buffer_size 32k;

Any clues on how to fix this?

0 likes
5 replies
eddieace's avatar

Here is the solution.

You enter the settings

fastcgi_buffers 16 16k; 
fastcgi_buffer_size 32k;

into etc/ngin/sites-available/example.com

and add it into the location ~ .php$ block

like this.

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;

        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;

    }
5 likes
fylzero's avatar

@eddieace SO glad you posted this! This just gave me a major headache. Thank you!

gregrobson's avatar

Thanks @eddieace - had a production server that wasn't playing ball with our payment provider. Other sites didn't say to add in the PHP section! :-D

Schmecker's avatar

I had the same problem after a wordpress update. changed the php version from 7.4.30 to 8.1.10

now everything works fine again.

have a wordpress site running, and got the upstream error only when I were logged in, on the frontend (logged in) backend worked fine.

Please or to participate in this conversation.