Welcome! Log In Create A New Profile

Advanced

Re: Why does nginx strip trailing headers from a proxied backend? How can I prevent it?

Maxim Dounin
June 08, 2020 05:00PM
Hello!

On Mon, Jun 08, 2020 at 08:57:56PM +0100, Alan Chandler wrote:

> I have nginx acting as the static file server for a single page
> web app I am developing. It acts as a proxy server for the
> "/api" portion on my url space.
>
> The backend server is running on a different port on local host
> and is nodejs based.. I'm using nginx as an http2 front end and
> using http 1/1 between nginx
> and the backend. In the main this is working well.
>
> But I have one problem. I would like to make use of a trailing
> header. My outgoing request has the header "TE: trailers", and
> the response has a header
> "Trailers: API-Status" and then after the body it adds (using
> nodejs response.addTrailers({'API-Status': 'OK'})).
>
> But nginx is stripping them out.

[...]

> My nginx config for the proxy is
>
> location /api/ {
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_set_header Host $http_host;
> proxy_set_header X-NginX-Proxy true;
> proxy_http_version 1.1;
> proxy_set_header Connection "";
> proxy_pass http://localhost:2040;
> proxy_redirect default;
> proxy_buffering on;
> proxy_cache off;
> }
>
> So how do I tell nginx to pass the trailing header?

Trailers are only supported in gRPC proxying (grpc_pass), where
they are required for gRPC. Trailers are not supported by
proxy_pass.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Why does nginx strip trailing headers from a proxied backend? How can I prevent it?

akc42 June 08, 2020 04:00PM

Re: Why does nginx strip trailing headers from a proxied backend? How can I prevent it?

Maxim Dounin June 08, 2020 05:00PM

Re: Why does nginx strip trailing headers from a proxied backend? How can I prevent it?

akc42 June 08, 2020 05:30PM

Re: Why does nginx strip trailing headers from a proxied backend? How can I prevent it?

Maxim Dounin June 08, 2020 09:52PM

Re: Why does nginx strip trailing headers from a proxied backend? How can I prevent it?

akc42 June 09, 2020 08:12AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 198
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