When Nginx is sent the following request, Apache is unable to get the "app_version" HTTP header.
I normally use apache_request_headers()
to get all headers.
I have also examined the contents of $_SERVER
GET /stuff HTTP/1.0
app_version: 1.0
Host: example.com
However, when the following header is sent, apache_request_headers()
does return the "app_version" HTTP header!
GET /stuff HTTP/1.0
Host: example.com
app_version: 1.0
The problem is, I am using a 3rd party REST client (Retrofit), and it seems to send the headers in a random order, so I cannot simply fix this by sending the Host header first. In any case, I don't see why a header with underscores in it, or the order it is placed in, should affect anything. (The header format is compatible with the HTTP spec). I would like a solution for the current problem, and not a workaround.
I have the following Nginx configuration:
underscores_in_headers on;
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_pass http://127.0.0.1:8080;
}
What would be causing this inconsistency?