Welcome! Log In Create A New Profile

Advanced

Proxy only on hostname

Posted by warren 
Proxy only on hostname
August 08, 2010 10:56PM
Hi,
I was hoping to proxy to multiple upstream servers on various ports from one nginx server listening on port 80.

I tried doing something like

if ($host ~* ^(mydomain.com|www.mydomain.com)$ ) {
proxy_pass http://mydomain_frontend_cluster/;
}

But of course that doesn't work inside an if statement. Is there anyway to proxy based on hostname, and if it is invalid or non existent, show some error page?

Thanks very much
-warren
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 144
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready