Google App Engine error "Upstream sent too big header"

1.1k views Asked by At

I am running a Laravel app with Google App Engine Standard PHP 7.2, with Elfinder package.

Today, I receive 502 error while trying to access Elfinder. Upon analyzing the log, I found this particular error:

96 upstream sent too big header while reading response header from upstream, client: XXX.XXX.XXX.XXX, server: , request: "GET /xxx/elfinder/connector?_token=XXX", upstream: "fastcgi://unix:/tmp/google-config/php-fpm.sock:", host: "XXX", referrer: "XXX".

After googling for similar problem, I found out it is probably a problem with nginx proxy_buffer_size. However, I did not know how to edit nginx.conf in Google App Engine Standard. Can anyone help me?

Thanks in advance.

2

There are 2 answers

2
woens On BEST ANSWER

I had the same issue on GAE standard php73 and this probaby has to do with the app.yaml

    SESSION_DRIVER:     cookie

setting (or in your .env) This sends all session info via the header, and this can become too big (dont know the GAE default limit)

You will need to use a redis (GCS memorystore) or database setting for the session. GCS memorystore was too expensive ($33 per month minimum) for me so I use the database as session driver.

1
Nibrass H On

You dont' have a nginx.conf file in App Engine Standard so that's why you can't edit or customize it.

You have a nginx.conf file in App Engine Flexible environment.

Here is the Official Google Cloud Platform Documentation to create an App Engine Flexible environment, and customize the nginx.conf file.

After creating a Google App Engine Flexible environment, if you still get the "Upstream sent too big header" error, it's due to that App Engine Flexible is using the default proxy_buffer_size which is 4K and you need more.

So you can put the following code in you nginx.conf file:

location / {
    try_files $uri /index.php?q=$uri&$args;
    fastcgi_buffers 16 16k;
    fastcgi_buffer_size 32k;
    proxy_buffer_size 128k;
    proxy_buffers 4 256k;
    proxy_busy_buffers_size 256k;

}