URL Redirection


#1

Hey guys, I’m a haproxy newbie. How would one redirect a URL in Haproxy? So I have a URL that is https://website.com/text/conversation. In my config I want to have it so if a user goes to https://website.com/text they will be redirected to website.com/text/conversation. Similar thing with voice, I have a website that’s website.com/voice/voicemail and I want whenever a user goes to website.com/voice they get redirected to website.com/voice/voicemail . How would I set that up for ACLs? Below is what I currently have/thought of for my haproxy.cfg which doesn’t do what I want. The root of the webpage is voice so anytime I hit the web page right it goes immediately to voice. But the redirection for text will not work at all. Can you please help? I’m using HAproxy version 1.5.14 FYI.

    frontend HTTPS_IN

  acl host_text hdr_end(host) /text/conversation
  acl path_text path_beg -i /text
  use_backend textqa if host_text or path_text

  acl host_voice hdr_end(host) /voice/voicemail
  acl path_voice path_beg -i /voice
  use_backend voiceqa if host_voice or path_voice

  default_backend voiceqa 
#------------------------------
# Backend pools
#------------------------------

backend voiceqa
mode http
option forwardfor
balance roundrobin
reqrep ^([^\ :]*)\ /voice(.*)     \1\ /\2
server IPAddress:80 check
server IPAddress:80 check

backend textqa
mode http
option forwardfor
balance roundrobin
reqrep ^([^\ :]*)\ /text(.*)     \1\ /\2
server IPAddress:80 check
server IPAddress:80 check