<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Life Scaling &#187; LAMP</title>
	<atom:link href="http://orensol.com/tag/lamp/feed/" rel="self" type="application/rss+xml" />
	<link>http://orensol.com</link>
	<description>Oren Solomianik's Blog</description>
	<lastBuildDate>Mon, 21 Jun 2010 08:10:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Nginx and Weird &#8220;400 Bad Request&#8221; Responses</title>
		<link>http://orensol.com/2009/01/18/nginx-and-weird-400-bad-request-responses/</link>
		<comments>http://orensol.com/2009/01/18/nginx-and-weird-400-bad-request-responses/#comments</comments>
		<pubDate>Sun, 18 Jan 2009 14:53:03 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
				<category><![CDATA[LAMP]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[bad request]]></category>
		<category><![CDATA[Cookie]]></category>
		<category><![CDATA[large_client_header_buffers]]></category>

		<guid isPermaLink="false">http://orensol.com/?p=27</guid>
		<description><![CDATA[<p>Most of the LAMP clusters I deal with on a daily basis use the same basic stack &#8211; an nginx at the front as a load balancer proxy, apache as the application server (running php), and mysql as the backend. I just realized that this stack might as well be called LNAMP or LAMPN, since [...]]]></description>
			<content:encoded><![CDATA[<p>Most of the LAMP clusters I deal with on a daily basis use the same basic stack &#8211; an nginx at the front as a load balancer proxy, apache as the application server (running php), and mysql as the backend. I just realized that this stack might as well be called LNAMP or LAMPN, since nginx plays a big part in it.</p>
<p>Problem with LAMPN, is that it sometimes takes its new stack name seriously, and starts limpin&#8217;. Nginx is an excellent front end &#8211; it&#8217;s highly configurable and highly efficient. But, it has a nasty habit of not letting your requests go through to the application servers if the request is hard for it to understand. Instead, it returns a &#8220;400 Bad Request&#8221; and dies.</p>
<p>So what was a request that was &#8220;hard to understand&#8221; in my case? It was a request with a very large &#8220;Cookie&#8221; header. If the cookies size of a certain domain sum up to more than <a href="http://wiki.codemongers.com/NginxHttpCoreModule#large_client_header_buffers" target="_blank">large_client_header_buffers</a>, your request is simply rejected by nginx. The default for large_client_header_buffers is:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">large_client_header_buffers <span style="color: #000000;">4</span> 4k
<span style="color: #000000; font-weight: bold;">/*</span> 4k being the page <span style="color: #c20cb9; font-weight: bold;">size</span> of the system, can be any <span style="color: #c20cb9; font-weight: bold;">size</span> depending on OS <span style="color: #000000; font-weight: bold;">*/</span></pre></div></div>

<p>The cookie header sent from my browser to the domain I tried to access was 4.4k in size, larger than the default size, so nginx flipped. I read <a href="http://www.ruby-forum.com/topic/173362" target="_blank">it is only a Firefox issue</a> (does IE split the Cookie to chunks? Is it even possible to send multiple chunks of a Cookie header?), but it might as well happen with other browsers and different requests. To solve the problem, the following setting in the http context will solve your problem:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">large_client_header_buffers <span style="color: #000000;">4</span> 8k</pre></div></div>

<p>Actually, nginx documentation mentions this problem, but it&#8217;s one of those default settings you think to yourself you&#8217;ll never have to change. Well, apparently, sometimes you do.</p>
]]></content:encoded>
			<wfw:commentRss>http://orensol.com/2009/01/18/nginx-and-weird-400-bad-request-responses/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->