I’m new to nginx so am probably making a simple mistake but, for the
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
the Content-Type header with value application/json from the access log:
$remote_addr - $remote_user [$time_local] “$request”
’ '$status $body_bytes_sent “$http_referer” ’ ‘"$http_user_agent"
127.0.0.1 - - [10/Dec/2014:18:34:49 -0800] “GET
HTTP/1.1” application/json 200 532 “-” “Apache-HttpClient/4.3.5 (java
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
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: