Welcome! Log In Create A New Profile

Advanced

Re: Regarding rewrite

June 24, 2012 03:10AM
Hi

Thank you for your suggestion, as I said, I can work around with a
different configuration. But I need to configure the system with many
servers because each of the server is a different virtual host each
with its own configuration. I was trying to understand if this is a
bug/limitation in the code or something more basic.

Best Regards

On Sat, Jun 23, 2012 at 5:29 PM, Valentin V. Bartenev <ne@vbart.ru> wrote:
> On Saturday 23 June 2012 11:00:16 Fasih wrote:
>> Hello all
>>
>> I have a usecase for a server rewrite, what I essentially want to do
>> is have a common domain like common.faskiri.com serve some contents
>> for specific domains like zone1.com, zone2.com etc. for some specific
>> url pattern.
>>
>> For instance:
>> common.faskiri.com/zone1/asset should basically be rewritten to
>> zone1/asset. Now zone1 has its own server section with /asset
>> configured.
>>
>> I tried using rewrite module and realized it doesnt seem to handle the
>> usecase I have.
>>
>> I created a plugin with NGX_HTTP_SERVER_REWRITE_PHASE expecting that
>> if I rewrite request.headers_in.server here, nginx would set the
>> srv_conf to zone1 and evaluate location config accordingly. But this
>> doesnt seem to work either, nginx seems to handle these cases with a
>> 301 redirect instead.
>>
>> For now I have configured my system to not use common.faskiri.com and
>> instead have common.zone1.com which uses the same set of location
>> config as zone1.com however what I failed to understand was, why is
>> server rewriting not allowed, or if it is allowed, how do I use it.
>>
>
> Why do you need several different "server" sections, instead of
> something like this:
>
>  server {
>     server_name common.faskiri.com;
>
>     location /zone1 {
>         # locations for /zone1 here
>     }
>
>     location /zone2 {
>         # locations for /zone2 here
>     }
>  }
>
> ?
>
>  wbr, Valentin V. Bartenev
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel

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

Regarding rewrite

faskiri.devel 1099 June 23, 2012 03:02AM

Re: Regarding rewrite

Valentin V. Bartenev 467 June 23, 2012 08:00AM

Re: Regarding rewrite

faskiri.devel 519 June 24, 2012 03:10AM

Re: Regarding rewrite

faskiri.devel 546 June 25, 2012 11:26AM



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

Online Users

Guests: 225
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