Welcome! Log In Create A New Profile

Advanced

Re: Converting subdomain to path component without redirect ?

henrique matias
May 04, 2013 09:40PM
Also i tried adding the address to the try_files:

try_files $uri $uri @app/de/; and try_files $uri $uri @app/de;

but that didn't work either.

The way i managed to provide translated content, was using a rewrite inside
of my location block: rewrite ^(.*)$ /my-language/$1 break;

That solves part of my problem.



The core basic of my problem is "Rewrite the URL based on the "server
name"".

So far the only options i see on nginx are:

1. Have a configuration with one "if" and one "rewrite" in order to map
server name to path

2. Multiple server declarations sharing the same configuration ( probably
using some sort of include? )


What you reckon? Any suggestion ?



On 5 May 2013 02:21, henrique matias <hems.inlet@gmail.com> wrote:

> My first try was to change my location / { } to proxy pass to another
> language, so i could try "the backend" as you said, but it actually didn't
> work, i got:
>
> [emerg] "proxy_pass" cannot have URI part in location given by regular
> expression, or inside named location, or inside "if" statement, or inside
> "limit_except" block in /etc/nginx/nginx.conf:79
>
> my nginx version is 1.3.15.
>
> will keep trying, if someone knows how to work this around, would be cool,
> i guess this happens quite often :P
>
> [s]
>
>
>
>
> On 4 May 2013 22:48, Francis Daly <francis@daoine.org> wrote:
>
>> On Mon, Apr 29, 2013 at 10:02:35PM +0100, henrique matias wrote:
>>
>> Hi there,
>>
>> > Am having trouble setting up my nginx.config to transparently proxy the
>> > subdomains and domains to the same app, but with different "path
>> > components" appended to the $uri
>>
>> Frequently, the main problem is that the back-end application makes it
>> very hard to do this.
>>
>> I suggest you test first using a separate server{} block for one
>> server_name and demonstrate to yourself that it can work.
>>
>> After that, you can worry about the details of how to auto-handle the
>> extra domains.
>>
>> Something like (untested):
>>
>> server {
>> server_name www.mydomain.it;
>> location / {
>> proxy_pass http://app_server/it/;
>> }
>> }
>>
>> maybe with "proxy_set_header Host www.mydomain.com;", or whatever your
>> application needs.
>>
>> The important things to check are, do links in the returned content work
>> when the browser asks for "/dir/" but the app_server gets a request for
>> "/it/dir/"?
>>
>> The above is *almost* the same as what you have here:
>>
>> > This is my last unsuccessful attempt: http://pastebin.com/bZZA30zC
>>
>> but there's an extra "/" in the proxy_pass line; and as you've not said
>> in what way yours was unsuccessful, it's hard to suggest a specific fix.
>>
>> Compare the output of "curl -i http://www.mydomain.com/it/SOMETHING"
>> with the output of "curl -i http://www.mydomain.it/SOMETHING", and with
>> what you expect the output to be.
>>
>> f
>> --
>> Francis Daly francis@daoine.org
>>
>> _______________________________________________
>> nginx mailing list
>> nginx@nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>>
>
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Converting subdomain to path component without redirect ?

henrique matias April 29, 2013 05:04PM

Re: Converting subdomain to path component without redirect ?

henrique matias April 30, 2013 07:10AM

Re: Converting subdomain to path component without redirect ?

Francis Daly May 04, 2013 05:50PM

Re: Converting subdomain to path component without redirect ?

henrique matias May 04, 2013 09:24PM

Re: Converting subdomain to path component without redirect ?

henrique matias May 04, 2013 09:40PM

Re: Converting subdomain to path component without redirect ?

Francis Daly May 05, 2013 04:18AM

Re: Converting subdomain to path component without redirect ?

henrique matias May 05, 2013 07:16PM

Re: Converting subdomain to path component without redirect ?

GreenGecko May 05, 2013 07:26PM

Re: Converting subdomain to path component without redirect ?

henrique matias May 06, 2013 11:36AM

Re: Converting subdomain to path component without redirect ?

Francis Daly May 05, 2013 04:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 244
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready