Proxied request header names in SPDY are always lowercase

Hello!

I have a question about the behavior of proxing SPDY to HTTP with nginx.

First, there is a configuration like the following.

upstream app {
    server 127.0.0.1:80;
    keepalive 32;
}

server {
    listen 443 ssl spdy;
    server_name example.com;

    proxy_set_header Connection "";
    proxy_http_version 1.1;

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Host  $host;
    proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

    location / {
         proxy_pass http://app;
    }
}

Next, send a request to example.com with spdycat.

spdycat is a command like curl for SPDY.

GitHub - tatsuhiro-t/spdylay: The experimental SPDY protocol version 2, 3 and 3.1 implementation in C

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(SPDY Protocol - Draft 3.1),

  • All header names must be lowercase.

Is this specific to a proxied request-header names to HTTP?
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!

Posted at Nginx Forum:

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.

[…]

Even if request-header names are uppercase, proxied them become lowercase.

According to SPDY Protocol - Draft
3.1(SPDY Protocol - Draft 3.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

Hello!

“spdycat” converts all headers to lowercase before send it over SPDY.

Oh, I had not notice it. Thanks(I assumed that nginx converts)

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

Maybe so. Sorry for confusion.

Thanks.

Posted at Nginx Forum: