Hello Moritz,

On Thu, Jul 15, 2010 at 01:45:19PM +0200, Moritz Krinke wrote:
> Hello,
> 
> currently i'm playing around with haproxy to replace our current 
> Big-IP/Lighttpd based LoadBalancing & Proxy solution.
> 
> Now i'm kinda stuck - i try to do a redirect (301) to a different domain and 
> a different URI, including a parameter from the old uri in the new one.
> 
> Example:
> Request to: www.example.com/123 should be redirected using a 301 to 
> www.example2.com/some/path/123
> 
> The only solution i came up with would be to use reqirep to rewrite the URI, 
> and than have an acl which matches exactly the old-domain+new-uri scheme and 
> use redirect code 301location... for the redirect.
> But this looks somehow ugly... is there a better/easier way to do these kind 
> of redirects?

I agree with you that it's ugly, but it's the way other people do it
when they absolutely need to do it there. Most often, the only reason
to do that on their load balancer is just to get rid of a server which
was dedicated to that, since the LB happens to be able to do that too.

Haproxy's goal is not (and has never been) to take this part of the
job which normally ought to be the application's job. But you know
how users are, if they can do it, they will do it ;-)

If you need more complex redirects, be aware that many people like to
combine haproxy+nginx on the same host and use nginx for the tricks
that are more application-level, as it is more flexible. That may be
an option to consider before your reqrep/redirect rules become
unmanageable ;-)

Regards,
Willy


Reply via email to