X-Forwarded-Proto / X_FORWARDED_PROTO

Eric Wong normalperson at yhbt.net
Sat Jan 9 17:39:03 EST 2010


skaar <skaar at waste.org> wrote:
> Eric,
> 
> think I came across an issue with the parser in unicorn, with a request
> (due to 2 layers of nginx proxying) coming across with both a
> X_FORWARDED_PROTO and a X-Forwarded-Proto header. From the socket (in
> HttpRequest) - we get:
> 
>   X_FORWARDED_PROTO: http
>   X-Forwarded-Proto: https
> 
> which is parsed to 
> 
>   HTTP_X_FORWARDED_PROTO"=>"http,https
> 
> There was a passenger ticket that describes that from nginx's point of
> view - X-Forwarded-Proto is the "correct" form. 

Hi skaar,

The Rack (and CGI) specs require that '-' be replaced with '_' for
HTTP header names, so Unicorn is doing the correct thing and treating
it as the same header.

Even though '_' appears to be allowed in header names by rfc 2616, it's
use is questionable as there are parsers that reject it.  Any chance of
fixing whatever sends the "X_FORWARDED_PROTO" header?  It's completely
pointless to set to "http"

-- 
Eric Wong


More information about the mongrel-unicorn mailing list