Nginx 502 Bad Gateway error ONLY in Firefox

前端 未结 4 1981
被撕碎了的回忆
被撕碎了的回忆 2021-02-08 23:14

I am running a website locally, all the traffic is routed through NGinx which then dispatches requests to PHP pages to Apache and serves static files. Works perfectly in Chrome

相关标签:
4条回答
  • 2021-02-08 23:56

    I seem to have found a work around that fixed my problem. After some additional Google research, I added the following lines to my Nginx config:

    proxy_buffers 8 16k;
    proxy_buffer_size 32k;
    

    However, I still don't know why this worked and why only Firefox seemed to have problems. If anyone can shed light on this, or offer a better solution, it would be much appreciated!

    0 讨论(0)
  • 2021-02-09 00:07

    open /etc/nginx/nginx.conf and add the following lines into http section :

    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;
    

    This fix worked for me in a CI web application. read more at http://www.adminsehow.com/2012/01/fix-nginx-502-bad-gateway-error/

    0 讨论(0)
  • 2021-02-09 00:09

    Increasing the size of your proxy buffers solves this issue. Firefox allows large cookies (up to 4k each) that are attached to every request. The Nginx default config has small buffers (only 4k). If your traffic uses big cookies, you will see the error "upstream sent too big header while reading response header" in your nginx error log, and Nginx will return a http 502 error to the client. What happened is Nginx ran out of buffer space while parsing and processing the request.

    To solve this, change your nginx.conf file

    proxy_buffers 8 16k; proxy_buffer_size 32k;

    -or-

    fastcgi_buffers 8 16k; fastcgi_buffer_size 32k;

    0 讨论(0)
  • 2021-02-09 00:21

    If you have firePHP disable it. Big headers causes problems while nginx comunication with php.

    0 讨论(0)
提交回复
热议问题