Re: redirecting many urls

From: Matt <mattmoran76#gmail.com>
Date: Thu, 3 Dec 2009 23:26:28 +0000


Willy that makes perfect sense, can't believe I didn't see it earlier.  Testing it right now and it appears to work fine.

Many thanks,

Matt

2009/12/3 Willy Tarreau <w#1wt.eu>:
> Hi Matt,
>
> replying quickly this time.
>
> On Thu, Dec 03, 2009 at 10:13:57AM +0000, Matt wrote:
>> Hi Willy, sure.
>>
>> I guess what i'd be writing with my knowledge of haproxy at the moment
>> is one of these for every user:-
>>
>> acl user1 url_beg /user1/mypage
>> redirect location http://mysite.com/user1/page code 301 if user1
>>
>> It would be great if I could do:
>> acl user1 url_reg /(.*)/mypage
>> redirect location http://mysite.com/\1/page code 301 if user1
>>
>> Prefix doesn't work in this context as the thing I want to change is
>> after the value i'm capturing.
>>
>> I've tried to think about how I could do it with the reqrep and rsprep
>> but i'm finding it hard to get my head round.  Especially since I
>> really wouldn't like the request to hit a server when I want to
>> redirect them.
>
> OK. What I think you should try, though I've not tested it, is to
> first rewrite the request using "reqrep" and put the fields in the
> order you like, then perform a prefix-based redirect. I think it
> should work, but there may be corner cases I'm not thinking about.
>
> Regards,
> Willy
>
>
Received on 2009/12/04 00:26

This archive was generated by hypermail 2.2.0 : 2009/12/04 00:30 CET