<p><br>
On Jun 20, 2012 8:42 AM, "Valentin V. Bartenev" <<a href="mailto:ne@vbart.ru">ne@vbart.ru</a>> wrote:<br>
><br>
> On Wednesday 20 June 2012 05:12:12 Matthieu Tourne wrote:<br>
> > Hi,<br>
> ><br>
> > I think, I've found an interesting corner case with the recent Nginx<br>
> > SPDY support.<br>
> > I'm using the latest : <a href="http://nginx.org/patches/spdy/patch.spdy-37.txt">http://nginx.org/patches/spdy/patch.spdy-37.txt</a><br>
> ><br>
> > I connect to Nginx using SPDY, and then proxy_pass to another server,<br>
> > with a location similar to this :<br>
> ><br>
> > location /redirect {<br>
> > add_header 'Status' '301 Moved Permanently';<br>
> > rewrite (.*) / permanent;<br>
> > }<br>
> ><br>
> ><br>
> > This causes Nginx to return 2 Spdy ":status" headers, which I guess is<br>
> > disallowed by the protocol.<br>
> ><br>
> ><br>
> > This is the output from spdycat (<a href="https://github.com/tatsuhiro-t/spdylay/">https://github.com/tatsuhiro-t/spdylay/</a>)<br>
> > Chrome reports a similar error.<br>
> ><br>
> > [ 0.141] [INVALID; status=PROTOCOL_ERROR] recv SYN_REPLY frame<br>
> > <version=2, flags=0, length=227><br>
> > (...)<br>
> > status: 301<br>
> > status: 301 Moved Permanently<br>
> ><br>
> ><br>
> > Note that this can be fixed using configuration to hide any potential<br>
> > "Status" header returned by the second server, before the Spdy<br>
> > response is generated.<br>
> > But the code should probably handle this ?<br>
><br>
> The problem is that spdy draft 2 reserved "status" and "version" header<br>
> names for its own purpose. This was fixed in draft 3, where all such<br>
> headers have the colon prefix (":status", ":version").<br>
><br>
> Personally, I think that since these headers are non-standard for HTTP<br>
> protocol, then the user is entirely responsible for their usage. However,<br>
> because the "Status" header is quite often appears somewhere, then hiding<br>
> of these headers inside the spdy module will cause less headaches.</p>
<p>Why not guarantee that all these reserved headers will only appear once in the response?<br>
This way the visiting browser never "breaks".</p>
<p>Nginx could always take the first header found in the http response for the spdy response. And avoid breaking just because the upstream is badly configured and returns 2 Version headers for example.</p>