proxy_pass not passing to dynamic $host

Francis Daly francis at
Fri Nov 1 17:57:41 UTC 2013

On Fri, Nov 01, 2013 at 12:29:24PM -0400, nehay2j wrote:

Hi there,

> Thanks Francis. I was able to get past this issue. Appreciate all the help.
> Now I am stuck at forwarding the POST parameters to this proxy server.
> proxy_pass http://$1:8080/clarity;

> If I uncomment 'proxy_set_header   Host' and 'proxy_set_header       
> X-Forwarded-For' it ends into 404 error.

I presume that the 404 comes from your upstream server. Use
proxy_set_header to set whatever header values that upstream needs,
to handle the request.

I suspect that "proxy_set_header Host $1;" is what you want -- or to
have no proxy_set_header directives at all so that the default applies.

> Otherwise it rewrites and proxies
> fine but doesnt pass the POST parameter.

It all works fine for me.

Can you provide evidence of where it fails to do what you expect?

Perhaps tcpdump the traffic, and see what does nginx send to upstream? If
it is the expected correct client request, then you should check what
the upstream does with a similar request that you make using, say, curl.

Provide a specific example of what exactly you do, ideally using "curl",
and what response you get, and what response you expect. That's the best
way of making it easier for someone else to help.

Francis Daly        francis at

More information about the nginx mailing list