Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can I configure haproxy to redirect a url ending in /video1?autoplay=1 to a different url but keeping the querystring value?

e.g

http://domain.com/video1?autoplay=1

needs to redirect to

http://newdomain/video/1?autoplay=1

I can do the acl to match the /video1 but cannot work out how to throw away everything to the left of the querystring

Thanks in advance

share|improve this question

I don't think HAproxy's current version has support for this kind of redirection. Does it really need to be HAproxy? Maybe you can also use Apache on the localhost and make it listen to say, port 81, and do the redirection but keep the query string through mod_rewrite. This will, of course, add an overhead, though.

share|improve this answer

Could you explain what it would be useful for ? It might be easy to implement in haproxy and could even be done before dev16 in a few days, but before adding features I need to be convinced about their use.

share|improve this answer
    
I single use case: website moved (from one domain to other) – jrumbinas Apr 6 '13 at 15:35
    
no, look, the request is changed, not only the domain. – Willy Tarreau Apr 24 '13 at 6:52
    
Oops, I haven't noticed it... How about redirect keeping the same query string? – jrumbinas Apr 24 '13 at 13:16
    
@WillyTarreau we are running into it being needed because we moved not only domains but backends as well so the new url schema is different and keeping old Google results going to the right place is important. – Matthew Clark Sep 29 '15 at 19:39
    
Then take a look at either haproxy 1.6 (with care) or HAPEE which include a lot more possibilities to manipulate parts of the URL individually and reuse other parts there. Now I think it should be quite possible. – Willy Tarreau Oct 21 '15 at 20:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.