LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Redirect - haporxy (https://www.linuxquestions.org/questions/linux-software-2/redirect-haporxy-4175582925/)

brandon65 06-23-2016 12:04 PM

Redirect - haporxy
 
Does anyone know how to do a redirect configuration haproxy to specific sub page, for example. example.com/contact

I tried different redirect, but it does not work, eg .:

Code:

redirect location https://example.coml code 301 if { hdr_beg(host) -i contact } !{ ssl_fc }
or:
Code:

acl is_example_contact_https hdr_beg(host)  -i example.com
acl url_cont url_beg /contact
use_backend bk-example_contact_https if  is_example_contact_https url_cont


backend bk-example_contact_https
    balance roundrobin
    cookie serv insert indirect nocache
    option forwardfor
    option httpclose
    default-server inter 1s
    server contact1 10.10.11.15:443


TenTenths 06-24-2016 05:25 AM

To be brutally honest, you should be doing these at the backend servers rather that at the haproxy server level. Keep haproxy for balancing and directing traffic.

Edit: This comes from recent experience trying to troubleshoot an issue that should have been in the vhosts file (or .htaccess) and then eventually finding out that it was being done by haproxy. :( :(


All times are GMT -5. The time now is 06:04 PM.