Ignore content-type while forwarding to backend proxy

one of my apps, specifically those on IOS forwarded a content-type
header…this is causing my backend server to mess up its security
signature check…
i need to be able to ignore content-type headers…
assigning the header as empty “” does not work, (proxy_set_header
Accept-Encoding “”;)and also tried mapping the content-type and using
the variable… though that did not work either as backend is very
strict in that regard…

i need to be able to ignore it completely…
i tried adding proxy_hide_header Content-Type;

and tested,it’s still sending content-type while directing traffic to
backend…

any advice?

Hello!

On Tue, Dec 23, 2014 at 05:10:09PM +0200, Roland RoLaNd wrote:

i tried adding proxy_hide_header Content-Type;

and tested,it’s still sending content-type while directing
traffic to backend…

any advice?

To control headers sent by nginx to backends you have to use the
“proxy_set_header” directive. If you want to hide Content-Type,
use this:

proxy_set_header Content-Type "";

More information can be found in the documentation here:

http://nginx.org/r/proxy_set_header


Maxim D.
http://nginx.org/

thank you for the advice!
i tried doing that before though it did not work so i thought there
could be another solution…in any case tried that again, set it right
before the proxypass condition and it’s still passing the type
through…may i show u my config to see what might be overrirding that ?

On Wed, Dec 24, 2014 at 08:53:13AM +0200, Roland RoLaNd wrote:

Hi there,

i tried doing that before though it did not work so i thought there could be
another solution…in any case tried that again, set it right before the proxypass
condition and it’s still passing the type through…may i show u my config to see
what might be overrirding that ?

The following config snippet does for me what you say that you want:

server {
proxy_set_header Content-Type “”;
location /app {
proxy_pass http://127.0.0.1:10080;
}
}

The response from port 10080 shows me that a Content-Type header was
received by it when I comment the proxy_set_header line; and was not
when I do not.

I suspect that it will be useful if you can describe what exactly you
want nginx to send to upstream.

Be specific about “http request header” and “http request body”; and
for best chance of help, make it easy for someone else to reproduce the
problem that you are reporting.

proxy_set_header only modifies the http request header sent.

It does not modify any part of the http request body.

In the case of (for example) multipart/form-data, the http request body
can contain its own header-like data including Content-Disposition:
and Content-Type:.

Good luck with it,

f

Francis D. [email protected]