Content-Type header not proxied to downstream hosts
nginx-forum at nginx.us
Thu Dec 11 02:47:21 UTC 2014
I'm new to nginx so am probably making a simple mistake but, for the life of
me, I can't see what.
I want to proxy requests with all headers that the request had to a
downstream server if it matches a regex. I also have an issue with the
regex, but let's leave that for another post.
The nginx conf is very simple. I know the request sent to nginx contains
the Content-Type header with value application/json from the access log:
$remote_addr - $remote_user [$time_local] "$request" $sent_http_content_type
' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent"
127.0.0.1 - - [10/Dec/2014:18:34:49 -0800] "GET /event/3F0046E6B50F75A8/info
HTTP/1.1" application/json 200 532 "-" "Apache-HttpClient/4.3.5 (java 1.5)"
However, the downstream host doesn't receive it. All other headers,
including custom headers, are sent.
My nginx config is basic, see this gist:
I have a workaround by manually adding the header, but I shouldn't have to
proxy_set_header Content-Type application/json;
I get the same result using nginx 1.4.4 and 1.6.2.
nginx -V output is below.
Any ideas what I'm doing wrong?
All help appreciated.
Output of nginx -V
nginx version: nginx/1.6.2
built by clang 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/Cellar/nginx/1.6.2
--with-http_ssl_module --with-pcre --with-ipv6
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,255412,255412#msg-255412
More information about the nginx