Redirecting to new URL


#1

Hi,

Here is my setup.

frontend http-in-ssl
bind *:80
bind *:443 ssl crt /etc/haproxy/ssl
log 127.0.0.1 local1 notice
option httplog
reqadd X-Forwarded-Proto:\ https
reqadd X-Forwarded-Proto:\ http

    acl alpha hdr(host) -i alpha.example.com
    acl beta hdr(host) -i beta.example.com
    redirect scheme https if !{ ssl_fc } alpha
    redirect scheme https if !{ ssl_fc } beta
    use_backend alpha-backend if { ssl_fc_sni alpha.example.com }
    use_backend beta-backend if { ssl_fc_sni beta.example.com }

backend alpha-backend
server alpha-server-server 192.168.1.100:8080 check inter 2000 maxconn 500 rise 2 fall 3
backend beta-backend
server beta-server-server 192.168.1.200:8090 check inter 2000 maxconn 500 rise 2 fall 3

Here i would like to achieve is if any one tried tried to hit alpha.example.com/rest/api it should redirecto to 192.168.1.150:8085 and convert all request to https

Thanks