Location based on querystring

Hi.

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.

How can this be done, eq i just want to proxy urls with ?id=* in it to
antoher backend.

Please help if can.

/Budala

Posted at Nginx Forum:

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 D.

good idea… thanks

Then another question, my backend application sucks so i need to take
some load off it with nginx.

lest say, http://domain.com/a.b.c.d?id=32323 is working as you
specified.

what do i do if http://domain.com/a.b.c.d/32323 sould be redirected to
http://domain.com/a.b.c.d?id=32323 ?

then everything should be perfect…

Posted at Nginx Forum: