Proxied request header names in SPDY are always lowercase

cubicdaiya nginx-forum at nginx.us
Sat Nov 1 14:06:53 UTC 2014


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.
# 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?
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: http://forum.nginx.org/read.php?2,254506,254506#msg-254506



More information about the nginx mailing list