Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4736

Implement basic authentication

$
0
0

@zahid.k11 wrote:

Hi Team,

Lets suppose I've configured a my website with domain name "abc.zahid.com" configured in nginx. I also use subdomains like "static1.abc.zahid.com", "static2.abc.zahid.com", "static3.abc.zahid.com" which are configured in same vhost as "abc.zahid.com"

Now I want a simple authentication on my haproxy where anybody who visits "abc.zahid.com" should be prompted (ONLY once) from a username and password. once the desired password is entered it should allow all sub domains as well.

I've done this on my setup on haproxy, however, it is prompting for authorization on every request plz help.

Following is my haproxy config:

userlist UsersFor_kennel
user username insecure-password password

frontend http-mpweb
bind 192.168.1.10:80
reqadd X-Forwarded-Proto:\ http
mode http
option http-server-close

    acl host_zahid hdr(host) -i abc.zahid.com
    use_backend static-backend if host_zahid

    acl host_zahid hdr(host) -i static1.abc.zahid.com
    use_backend static-backend if host_zahid

    acl host_zahid hdr(host) -i static2.abc.zahid.com
    use_backend static-backend if host_zahid

    acl host_zahid hdr(host) -i static3.abc.zahid.com
    use_backend static-backend if host_zahid

backend static-backend

acl AuthOkay_kennel http_auth(UsersFor_kennel)
http-request auth realm kennel if !AuthOkay_kennel

    balance roundrobin
    option http-server-close
    option forwardfor
    cookie mpstatic insert indirect nocache
    option httpchk HEAD /LoadBalancer_HealthCheck.php HTTP/1.0
    server web 192.168.1.20:80 cookie mpstatic1 check

Kindly let me know if any issue with above config.

Best Regards,
Zahid

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4736

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>