Skip to content

Instantly share code, notes, and snippets.

@zhaow-de
Last active December 15, 2023 09:39
Show Gist options
  • Save zhaow-de/ac3c973e1212327588e01b0304c2c762 to your computer and use it in GitHub Desktop.
Save zhaow-de/ac3c973e1212327588e01b0304c2c762 to your computer and use it in GitHub Desktop.
Line#44-45, 49 put a basic_auth in front of the HAProxy
global
log stdout format raw local0
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 1024
user haproxy
group haproxy
defaults
mode http
log global
log-format "%ST %B %{+Q}r"
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 1024
listen stats
bind 0.0.0.0:4444
mode http
log global
maxconn 30
timeout client 100s
timeout server 100s
timeout connect 100s
timeout queue 100s
stats enable
stats hide-version
stats refresh 30s
stats show-desc
stats show-legends
stats show-node
stats uri /
userlist mycredentials
user joe insecure-password joespassword
frontend main
bind 0.0.0.0:3128
http-request auth unless { http_auth(mycredentials) }
default_backend privoxy
mode http
backend privoxy
balance roundrobin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment