Welcome! Log In Create A New Profile

Advanced

Help with rewrite and proxy pass

Posted by ressaid 
Help with rewrite and proxy pass
April 10, 2010 01:17PM
Hi Guys,

Just starting out on NGiNX so I apologize if this is too basic. I am trying to configure NGiNX to route traffic to coming in to my server to different ports and different services based on the URL coming in. Then I want to take that and based on the user agent append low/med/high to the requested URL. I thought I had it but I keep getting errors when I put the coe in the config file. Any help would be very much appreciated.

EX) if (request comes *.images.domain.com/a.jpg)
{
if (user_agent ~ MSIE) {
change uri to *images.domain.com/MSIE/a.jpg
pass to a new port
}

My code:

if ($host ~* (.*).images.domain.com) {

if ($http_user_agent ~ MSIE) {
rewrite /images/(.*) /images/MSIE/(.*) break;
proxy_pass http://localhost:8080;}
}}

When I put that code in the config file I get an error that "if" is not a defined function.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 166
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