Welcome! Log In Create A New Profile

Advanced

Re: nginx-devel Digest, Vol 32, Issue 13

Thomas
June 12, 2012 09:24AM
On Tue, Jun 12, 2012 at 8:00 PM, <nginx-devel-request@nginx.org> wrote:
>
> Send nginx-devel mailing list submissions to
>        nginx-devel@nginx.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://mailman.nginx.org/mailman/listinfo/nginx-devel
> or, via email, send a message with subject or body 'help' to
>        nginx-devel-request@nginx.org
>
> You can reach the person managing the list at
>        nginx-devel-owner@nginx.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of nginx-devel digest..."
>
>
> Today's Topics:
>
>   1. Is there any way to redirect request to another server conf?
>      (Thomas)
>   2. Re: Is there any way to redirect request to another server
>      conf? (Ant?nio P. P. Almeida)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 12 Jun 2012 19:29:56 +0800
> From: Thomas <sunyxing@gmail.com>
> To: nginx-devel@nginx.org
> Subject: Is there any way to redirect request to another server conf?
> Message-ID:
>
>  <CAJLop126QHAWyEfKug8MzR9Bth0C-mafRuwwW2HVRYF+i1hPMA@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> 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-0001.html
>
> ------------------------------
>
> Message: 2
> Date: Tue, 12 Jun 2012 13:40:09 +0200
> From: Ant?nio P. P. Almeida <appa@perusio.net>
> To: nginx-devel@nginx.org
> Subject: Re: Is there any way to redirect request to another server
>        conf?
> Message-ID: <87vciwg3mu.wl%appa@perusio.net>
> Content-Type: text/plain; charset=US-ASCII
>
> On 12 Jun 2012 13h29 CEST, sunyxing@gmail.com wrote:
>
> > 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;
>
> Doesn't this do what you need?
>
> server {
>    listen 80 default_server;
>
>    location /a.com/index.html {
>        return 302 http://a.com$request_uri;
>    }
>
>    location /b.com/index.html {
>        return 302 http://b.com$request_uri;
>    }
> }
>
> --- appa
>

Thanks for advice. Since my servers are supposed to handle the request
directly and independently, 302/301 are not acceptable in this
situation.

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Re: nginx-devel Digest, Vol 32, Issue 13

Thomas 921 June 12, 2012 09:24AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 267
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready