1

I'm trying to configure haproxy (1.5.8) in reverse proxy mode linking to some kind of virtualhost hosted on an old Unix server. The haproxy will be in DMZ and the webserver on the LAN.

Basically I want:

https://a.domain.com/lo -> http://a.b.c.d:5000/lo
https://a.domain.com/lp -> http://a.b.c.d:5500/lp

By defaut the Unix server will throw a virtualhost error if i try to connect to http://a.b.c.d:5000/, and will display the webpage if I open http://a.b.c.d:5000/lo.

frontend ft1
        mode http
        option forwardfor
        bind *:443 ssl crt /etc/ssl/certs.pem
        use_backend bk_Lo if { path_beg /lo }
        use_backend bk_Lp if { path_beg /lp }
        default_backend bk_Lo

backend bk_Lo
        mode http
        server lo a.b.c.d:5000

backend bk_Lp
        mode http
        server lp a.b.c.d:5500

But I can't figure a way to rewrite the url correctly, I always end up with an error 503. Is this even possible with haproxy ? Can someone point me in the right direction to solve this?

Thank you for your help.

Davron

0
global
    log         127.0.0.1 local0
    maxconn     2000
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    user        haproxy
    group       haproxy
    daemon
    stats socket /var/lib/haproxy/stats

defaults
    log                     global
    option                  dontlognull
    option                  redispatch
    retries                 3
    timeout connect         5000s
    timeout client          1200000s
    timeout server          1200000s

frontend http_proxy
    mode http
    bind *:443 ssl crt /etc/ssl/cert_for_a.pem crt /etc/ssl/cert_for_b.pem
    option httplog
    option http-server-close

    acl a_domain_url hdr_beg(host) a.domain.com
    use_backend bk_Lo if { path_beg /lo }

    acl work_url hdr_beg(host) b.domain.com
    use_backend bk_Lp if { path_beg /lp }

backend bk_Lo
    mode http
    server lo a.b.c.d:5000

backend bk_Lp
    mode http
    server lo a.b.c.d:5500

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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