Tag: nginx error

  • Nginx upstream sent too big header

    Nginx upstream sent too big header

    When I log in to a PrestaShop website, I get an error on a Plesk server.

    502 Bad Gateway
    

    On checking error login for the site in folder /var/www/vhosts/domain.com/logs/proxy_error_log, I found the following error message

    proxy_error_log:2020/11/25 19:41:41 [error] 1809#0: *39664 upstream sent too big header while reading response header from upstream, client: 59.92.71.53, server: tulivesi.com, request: “POST /en/login?back=my-account HTTP/2.0”, upstream: “https://shop.serverok.in:7081/en/login?back=my-account”, host: “shop.serverok.in”, referrer: “https://shop.serverok.in/en/login?back=my-account”

    To fix, add the following to Nginx config.

    If Nginx works as a reverse proxy to another application server.

    proxy_buffer_size          128k;
    proxy_buffers              4 256k;
    proxy_busy_buffers_size    256k;
    

    If Nginx serve pages using FastCGI/fpm.

    fastcgi_buffers 16 16k; 
    fastcgi_buffer_size 32k;
    

    On Plesk Server

    On Plesk, go to the domain name, then click “Apache & nginx Settings”. On next page add the following code and click OK.

    proxy_buffer_size          128k;
    proxy_buffers              4 256k;
    proxy_busy_buffers_size    256k;
    

    Plesk Nginx

    See Nginx

  • Nginx HTTP 414 request-URI too large

    Nginx HTTP 414 request-URI too large

    On a Nginx server, when accessing a long url, i get error

    HTTP 414 Request-URI Too Large
    

    Nginx HTTP 414 request-URI too large

    To fix the error, edit

    vi /etc/nginx/nginx.conf
    

    inside “http” section, find

    large_client_header_buffers
    

    Replace the line with

    large_client_header_buffers 4 32k;
    

    If your URL is very large, you may need to increase the 32k to higher or reduce the url length.

    Large url like this mostly happend due to bad application design, so if possible try to make URL smaller.

    Restart nginx

    systemctl restart nginx
    

    On older servers (centos 6, ubuntu 14, etc..), run

    service nginx restart
    

    See Apache 414 Request-URI Too Long, Nginx