Welcome! Log In Create A New Profile

Advanced

Re: Set a particular location for address starting with '?'

September 23, 2009 09:36PM
On Wed, 2009-09-23 at 19:38 -0400, mvip wrote:
> I think I've tried all different approaches for this, but here is the problem: I need to separate all URLs starting with '/?' from the remaining ones (eg /?p=12).
>
> I've tried a bunch of different regex matches, but none of them seems to be able to match URLs starting with a '?'. I already started a thread here (http://forum.nginx.org/read.php?11,8435), but Jim referred me over to the mailing list.
>
> Configuration options I've tried includes:
> 'location ^~ \?.* { proxy_pass http://blog.foobar.com;}' and
> 'location ~ /\?.* { proxy_pass http://blog.foobar.com;}'
>
> The above regexes should match the request, but for some reason they don't. Could anyone please provide me with a solution here?

That's because Nginx doesn't match locations on the query string. I
think you are most likely approaching this wrong anyway. Judging from
the little you've described, my *guess* is that you need to proxy any
request that can't be mapped directly to an actual file:

location / {
root /path/to/root;
try_files $uri @myapp;
}

location @myapp {
proxy_pass http://blog.foobar.com;
}

Regards,
Cliff
Subject Author Posted

Set a particular location for address starting with '?'

mvip September 23, 2009 07:38PM

Re: Set a particular location for address starting with '?'

Cliff Wells September 23, 2009 09:36PM

Re: Set a particular location for address starting with '?'

mvip September 24, 2009 09:30AM

Re: Set a particular location for address starting with '?'

mvip September 24, 2009 12:22PM

Re: Set a particular location for address starting with '?'

Cliff Wells September 24, 2009 11:12AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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