Nginx for proxy + rewrite

Pavel Georgiev pavel at netclime.com
Wed Feb 27 21:30:47 MSK 2008


Hi, List!

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?





More information about the nginx mailing list