location based on querystring

Maxim Dounin mdounin at mdounin.ru
Tue Feb 16 13:03:02 MSK 2010


Hello!

On Tue, Feb 16, 2010 at 03:31:10AM -0500, budala10 wrote:

> Let's say ia have 2 different url's to a backend.
> 
> On is http://domain.com/a.b.c.d, this i just want to proxy to a 
> backend.
> 
> But if the reguest is like, http://domain.com/a.b.c.d?id=1222 
> then i would like to proxy it somewhere else.

    location = /a.b.c.d {
        if ($args = "id=1222") {
            rewrite ^ /a.b.c.d.id1222 last;
        }
        proxy_pass ...;
    }

    location = /a.b.c.d.id1222 {
        proxy_pass ...;
    }

Maxim Dounin



More information about the nginx mailing list