NGINX not passing header to proxy
Francis Daly
francis at daoine.org
Mon Dec 31 16:58:48 UTC 2018
On Mon, Dec 31, 2018 at 10:01:54AM -0500, Sesshomurai wrote:
Hi there,
> I am having a problem with NGINX not forwarding a request header to my
> proxy.
>
> Here is the location:
>
> location /xyz {
> proxy_pass_request_headers on;
> proxy_pass https://someserver/;
> }
>
> I make the call passing "userAccount" header and it never gets sent to the
> proxy, but if I declare it in the location, it does get passed.
> Other headers are passed to proxy.
You seem to report that when you do
curl -H userAccount:abc http://nginx/xyz
you want nginx to make a request to https://someserver/ including the
http header userAccount; and that nginx does make the request but does
not include the header. Is that correct?
A simple test, using http and not https, seems to show it working as you
want here. Does the same test work for you? If so, does using https make
a difference to you?
==
# "main" server
server {
listen 8090;
location /xyz {
proxy_pass http://127.0.0.1:8091/;
}
}
# "upstream" server
server {
listen 8091;
location / {
return 200 "request: $request; userAccount: $http_useraccount\n";
}
}
==
$ curl -H userAccount:abc http://127.0.0.1:8090/xyz
request: GET / HTTP/1.0; userAccount: abc
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list