Proxied request header names in SPDY are always lowercase

Valentin V. Bartenev vbart at nginx.com
Sat Nov 1 14:23:56 UTC 2014


On Saturday 01 November 2014 10:06:53 cubicdaiya wrote:
> Hello!
> 
> I have a question about the behavior of proxing SPDY to HTTP with nginx.
> 
[..]
> # spdycat is a command like curl for SPDY.
> # https://github.com/tatsuhiro-t/spdylay
> spdycat \
>    --spdy3-1 \
>    -H "User-Agent: spdycat" \
>    -H "X-VERSION: 1.3.1" \
>    "https://example.com/"
> 
> In this case, a proxied request to app is the following according to `#
> ngrep -W byline port 80 -d lo`
> 
> GET / HTTP/1.1
> Host: example.com
> X-Real-IP: xxx.xxx.xxx.xxx
> X-Forwarded-Host: example.com
> X-Forwarded-For: xxx.xxx.xxx.xxx
> X-Forwarded-Proto: https
> accept: */*
> accept-encoding: gzip, deflate
> user-agent: spdycat
> x-version: 1.3.1
> 
> 
> Even if request-header names are uppercase, proxied them become lowercase.
> 
> According to SPDY Protocol - Draft
> 3.1(http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3-1), 
> 
>  * All header names must be lowercase.
> 
> Is this specific to a proxied request-header names to HTTP?

This is specific to SPDY protocol.  And "spdycat" converts all
headers to lowercase before send it over SPDY.  Nginx just pass
them as is, since case in HTTP doesn't matter.


> Or is there a solution except for the following workaround?
> 
> proxy_set_header User-Agent $http_user_agent;
> proxy_set_header X-Version $http_x_version;
> 
> Thanks in advance!
> 

There's cannot be any other solution than explicit specifying
what letters in headers you want to be in uppercase, since
this information are lost in the client.

But the question is why do you care?  It seems if you care
about it, you're definitely doing something wrong.

  wbr, Valentin V. Bartenev



More information about the nginx mailing list