proxy_pass not passing to dynamic $host

Francis Daly francis at daoine.org
Sat Nov 2 09:18:37 UTC 2013


On Fri, Nov 01, 2013 at 09:45:18PM -0400, nehay2j wrote:

Hi there,

> I did a curl on the url - curl -i https://example.com/23.23.234.234

> HTTP/1.1 302 Found
> Location: https://marketplace.example.com/marketplace/marketplace/login

> Which is correct.

I confess that I don't see how the configuration you show below can lead
to that response. But I don't know what upstream is doing, so maybe it
all just works.

Do you get the same response from upstream if you avoid nginx?

  curl -i -H Host:example.com http://23.23.234.234:8080/test

Also, are you aware that a HTTP 302 will cause the browser url to
change? Once the browser gets the above response, the next request goes
to marketplace.example.com and not to example.com.

> But when I submit post request through browser, I gives me
> a 404 with no error in logs.

If there's nothing in the logs, that suggests that you weren't talking
to nginx. Or that your nginx logging level is too low for what you are
trying to see.

What happens when you submit a post using curl, so you can see exactly
what happens without the browser getting in the way?

  curl -i -d key=value https://example.com/23.23.234.234

> Should i be using rewrite command here or not?

I would have thought "not", but I don't know what that rewrite directive
is intended to do in the first place.

> If I remove rewrite command, it give file not found error as it picks
> default root path always.

Here, you haven't said what request you made or what result you expected.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list