Is there any way to redirect request to another server conf?

Thomas sunyxing at gmail.com
Tue Jun 12 11:29:56 UTC 2012


Hi All,

    I'm trying to use nginx as a proxy server which can judge server name
by url.

   e.g.

   server {
      listen 80 default_server;
      my_rewrite_directive;
   }

   server {
      server_name a.com;
      root html/a;
   }

   server {
      server_name b.com;
      root html/b;
   }

  then  GET /a.com/index.html  will be redirected to server a.com;

I tried to write a module to accomplish this by modifying members in http
request structure, but it seems that r->srv_conf has already been set
before running module phases. I tried internal redirect and it didn't help.
so my question is,

Is there any way to redirect request to another server conf without
modifying the nginx core?

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20120612/586cecfa/attachment.html>


More information about the nginx-devel mailing list