Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx big header response

"upstream sent too big header while reading response header from upstream"

I keep getting this when I try and do an authentication from facebook. I've increased my buffers:

proxy_buffer_size   256k;
proxy_buffers   8 256k;
proxy_busy_buffers_size   512k;
fastcgi_buffers 8 256k;
fastcgi_buffer_size 128k;

But it doesn't seem to help. Any thoughts as to why this might occur?

nginx.conf file:

user www-data;
worker_processes  1;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
    # multi_accept on;
}


http {
    include       /etc/nginx/mime.types;

proxy_buffer_size   256k;
proxy_buffers   8 256k;
proxy_busy_buffers_size   512k;
fastcgi_buffers 8 256k;
fastcgi_buffer_size 128k;

    access_log  /var/log/nginx/access.log;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;

    gzip  on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

/etc/nginx/sites-enabled/default

server {
    listen   80 default;
    server_name  localhost;

    access_log  /var/log/nginx/localhost.access.log;

    location / {
        root   /var/www/nginx-default;
        index  index.html index.htm;
    }

    location /doc {
        root   /usr/share;
        autoindex on;
        allow 127.0.0.1;
        deny all;
            }

    location /images {
        root   /usr/share;
        autoindex on;
    }
}
like image 756
Aram Papazian Avatar asked Jul 17 '12 16:07

Aram Papazian


2 Answers

In codeigniter I had the same error. This works for me:

http://forum.nginx.org/read.php?2,192785,196003#msg-196003

In .conf

location ~* \.php$ {
    fastcgi_pass 127.0.0.1:9001;
    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    # 16-sept-2012 parametros para evitar el 502
    fastcgi_temp_file_write_size 10m;
    fastcgi_busy_buffers_size 512k;
    fastcgi_buffer_size 512k;
    fastcgi_buffers 16 512k;
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_intercept_errors on;
    fastcgi_next_upstream error invalid_header timeout http_500;
}
like image 68
pacofelc Avatar answered Nov 17 '22 21:11

pacofelc


I had the same exact issue this morning. However, increasing buffer size worked for me. This is the settings that I used:

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

The only setting I don't see in your config is

   proxy_temp_file_write_size 256k;

Also, I added these values just for that vhost. I don't think it should matter, but might be worth trying.

like image 2
gsharma Avatar answered Nov 17 '22 22:11

gsharma