Nginx for proxy + rewrite
Igor Sysoev
is at rambler-co.ru
Wed Feb 27 21:59:00 MSK 2008
On Wed, Feb 27, 2008 at 08:30:47PM +0200, Pavel Georgiev wrote:
> I`ve beed using nxingx as a local balancer for few backend servers:
>
>
> http {
> upstream mydomain.com {
> server 192.168.8.30; # backend server
> }
> server {
> listen 192.168.10.1:8080;
> server_name cmydomain.com;
>
> location / {
> proxy_pass http://mydomain.com;
> proxy_redirect off;
> proxy_set_header Host $host;
> }
> }
> }
>
>
> What I need to do is for a certain url to rewrite it to an external url but
> serve the requests as a proxy instead of returing a redirect, so this is
> transparent to the client:
>
> http://mydomain.com/redirect/(.*)$ should go to http://extranal.comain.com/$1
>
> I saw this is possible with a simple rewrite but it returns a redirect to the
> client. Is is possible to make nginx to server the rewrite as a proxy?
I'm not sure that understand your problem, but this may help:
proxy_pass http://mydomain.com;
proxy_redirect http://mydomain.com/ /;
proxy_redirect http://mydomain.com/redirect/ /;
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list