6 messages in ru.sysoev.nginxRe: Nginx for proxy + rewrite
FromSent OnAttachments
Pavel GeorgievFeb 27, 2008 10:30 am 
Igor SysoevFeb 27, 2008 10:58 am 
Igor SysoevFeb 27, 2008 11:08 am 
Pavel GeorgievFeb 27, 2008 12:26 pm 
Igor SysoevFeb 27, 2008 12:42 pm 
Pavel GeorgievFeb 28, 2008 3:09 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Nginx for proxy + rewriteActions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Feb 27, 2008 11:08:22 am
List:ru.sysoev.nginx

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?

Or probably, you need X-Accel-Redirect:

http://wiki.codemongers.com/NginxXSendfile