docksal / service-vhost-proxy

Virtual host proxy service image for Docksal
http://docksal.io
MIT License
7 stars 14 forks source link

Fix the problem with "upstream sent too big header while reading response header from upstream" #12

Closed achekulaev closed 7 years ago

achekulaev commented 7 years ago

Sometimes Drupal may send header that are too long. This happens for instance when http.response.debug_cacheability_headers are set to true. vhost-proxy fails to proxy requests in this case.

Despite answer here says that disabled buffers also work the truth is only buffers work (checked on local with setup where I can replicate the issue).

lmakarov commented 7 years ago

After doing some research around how ngx_http_proxy_module works and can be configured I can say that raising proxy_buffer_size is the only necessary change.

proxy_buffer_size: The initial portion of the response from a backend server, which contains headers, is buffered separately from the rest of the response.

proxy_buffer_size is 4k by default, which apparently is not sufficient when your sites starts spitting out huge response headers. Raising it to 16k should give enough room for those edge cases.

proxy_buffer_size 16k;
lmakarov commented 7 years ago

A good read on the topic: https://www.digitalocean.com/community/tutorials/understanding-nginx-http-proxying-load-balancing-buffering-and-caching