March 17, 2011

Facebook Connect, Cookies, Nginx and 400 Bad Request Errors

Filed under: Uncategorized — Tags: , — yasi8h @ 10:15 am

One of my colleagues were having a problem with getting Facebook connect to work in one of his rails apps. The strange thing was that it worked fine on his local. But when he uploaded the app to staging (which was a standard nginx/passenger/mysql/ubuntu stack), he would get a weird 400 Bad Request error after authentication and redirection from Facebook.

After googling around for a while it turned out that nginx has a limit on the request header size.

“maximum number and size of buffers for large headers to read from client request.” – from nginx documentation (

Increasing this solved the problem.

The current setting is at large_client_header_buffers 4 8k and it seems to work fine so far.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at

%d bloggers like this: