I am using NGinx as proxy to load balance the traffic. Behind Nginx their are some unicorn servers. On Friday I did some changes on the server and I realized that I am always running into a Bad Gateway error. The way from Nginx to unicorn worked. But the way back not really.
I googled for it and I found out that the problem is the buffer size on NGinx. After setting the buffer sizes up like this here, it worked fine for me.
proxy_buffer_size 128k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k;
You have to add this to your default.conf file in “/etc/nginx/conf”.