In the past one of our clients ran in to the problem of having a certain page(while being logged in) return a 502 error (upstream sent too big header while reading response header from upstream) after having expanded the pages content.

We've increased the nginx cgi configuration settings but I'm wondering what caused the problem. I'm right now able to reproduce the problem by adding an absurd amount to the header with:

if ( isset( $_GET['add_to_header'] ) ) {
    add_filter( 'wp_headers', function( $headers ) {
        $headers['Junk'] = bin2hex( openssl_random_pseudo_bytes( $_GET['bytes'] ) );
        return $headers;
    } );

The above example gives me a slight confirmation that the 502 error was being caused by the header being to big.

I've searched the project for all header('', '');, @header and add_filter( 'wp_headers', ... ) occurences but did not manage to find the cause of the problem(that I was having before increasing NginX cgi configuration settings).

I was wondering if anyone has tips to find out what was causing the problem without having to change the NginX configuration back to default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.