Welcome! Log In Create A New Profile

Advanced

Re: Using map and proxy_pass

Markus Jelsma
April 29, 2011 11:50AM
Accidentally sent it too early. See below

> Hi list,
>
> I'm pulling my hair out. I need to pass to different proxies based on the
> first uri segment but don't seem be able to get it working.
>
> I have the following map:
>
> map $uri $upstream
> {
> /abc/bla/ host01;
> /xyz/bla/ host02;
> }
>
> Originally i tried using regex in the uri because different 2nd segments
> can be used, doing /abx/(.*)/ doesn't work either, or i'm using it the
> wrong way. So for now i'm trying with fixed uri's.
>
> In the location handling the 2nd segment i rewrite and proxy_pass.
>
> location ~ "/(.*)/abc"
> {
> rewrite ^(.*)$ /another_segment$1 break;
> proxy_pass http://$upstream:8080;
> }

I've tried various approaches such as using $upstream in rewrite or other
combinations but they always result in a HTTP 500 error:

2011/04/29 15:50:44 [error] 17886#0: *2 invalid host in upstream ":8080",

etc.

Is there anyone that can point me in the right direction?

>
>
> Cheers,
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Using map and proxy_pass

Markus Jelsma April 29, 2011 11:48AM

Re: Using map and proxy_pass

Markus Jelsma April 29, 2011 11:50AM

Re: Using map and proxy_pass

gregr401 April 29, 2011 11:40PM

Re: Using map and proxy_pass

Markus Jelsma April 30, 2011 06:54AM

Re: Using map and proxy_pass

Markus Jelsma May 02, 2011 08:58AM

Re: Using map and proxy_pass

Francis Daly May 02, 2011 11:36AM

Re: Using map and proxy_pass

Igor Sysoev May 03, 2011 05:12AM

Re: Using map and proxy_pass

Markus Jelsma May 03, 2011 07:04AM

Re: Using map and proxy_pass

Igor Sysoev May 03, 2011 08:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 119
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready