HAProxy community

HAProxy Basic auth on website redirect


#1

I am trying to configure my HAProxy to redirec to a certain webpage with Basic Auth without changing the hostname.

backend lf_was_9080
   acl auth_lf_was http_auth(lf_was_auth_list)
   http-request auth realm lf_was_auth_list if !auth_lf_was
   #mode tcp
   server lf_was_9080 10.85.200.158:9080/lf4html/login.jsp check
   redirect code 301 location http://10.85.200.158:9080/lf4html/login.jsp

frontend http-in
    bind *:80
    #Configure SSL & Forward Headers
    bind *:443 ssl crt /etc/ssl/my.platform.com
    reqadd X-Forwarded-Proto:\ https
    reqadd X-Forwarded-Port:\ 443

    acl lf_was_9080_in hdr(host) -i sys1204.my.platform.com
    use_backend lf_was_9080 if lf_was_9080_in

I do not get any HTTP authentication on the webpage. I also do no want the redirect to happen rather stay on the same address.

Now the haproxy redirects to the page without HTTP authentication.

How can I add the server parameter to point to a page in HAProxy and enable HTTP authentication