NGINX not passing header to proxy

Sesshomurai nginx-forum at forum.nginx.org
Tue Jan 1 16:48:36 UTC 2019


HI Francis,
  Turns out it's not passing the other header I need, "x-api-key".

$ curl -i -H "x-api-key:somevalue" -H "userAccount:someaccount" 
https://localhost/somepath --insecure
HTTP/1.1 200 OK
Server: nginx/1.10.3 (Ubuntu)
Date: Tue, 01 Jan 2019 16:47:15 GMT
Content-Type: application/octet-stream
Content-Length: 91
Connection: keep-alive

request: GET /api/ecfr/0.1.0?index=title48 HTTP/1.1; x-api-key: ;
userAccount: someaccount


Francis Daly Wrote:
-------------------------------------------------------
> 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
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,282518,282524#msg-282524



More information about the nginx mailing list