regex in proxy_pass

Igor Sysoev igor at sysoev.ru
Tue Feb 9 14:48:57 MSK 2010


On Sun, Feb 07, 2010 at 11:14:06PM +0200, pablo platt wrote:

> I'm trying to proxy requests
> from http://example1.com/test/some/path
> to http://test.example2.com/some/path
> 
> I've tried:
> location ~ ^/(.*)/ {
>       proxy_pass http://$1.example2.com;
>       proxy_buffering off;
>       proxy_read_timeout 3600;
> }
> 
> How can I do this?

It should work. Probably, you need to define
   resolver  127.0.0.1;
and setup name server on localhost.


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list