Welcome! Log In Create A New Profile

Advanced

Re: NGINX not passing header to proxy

January 01, 2019 11:48AM
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@daoine.org
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

NGINX not passing header to proxy

Sesshomurai December 31, 2018 10:01AM

Re: NGINX not passing header to proxy

Francis Daly December 31, 2018 12:00PM

Re: NGINX not passing header to proxy

Sesshomurai January 01, 2019 11:48AM

Re: NGINX not passing header to proxy

Sesshomurai January 01, 2019 11:58AM

Re: NGINX not passing header to proxy

Sesshomurai January 01, 2019 12:32PM

Re: NGINX not passing header to proxy

Francis Daly January 02, 2019 07:50AM

Re: NGINX not passing header to proxy

Sesshomurai January 02, 2019 11:57AM

Re: NGINX not passing header to proxy

Sesshomurai January 02, 2019 12:17PM

Re: NGINX not passing header to proxy

Francis Daly January 02, 2019 03:18PM

Re: NGINX not passing header to proxy

Sesshomurai January 03, 2019 06:17PM

Re: NGINX not passing header to proxy

Francis Daly January 04, 2019 06:48AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 296
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready