Skip to content

Instantly share code, notes, and snippets.

$ curl --get --user admin:mypassword \
http://localhost:5555/v2/services/haproxy/configuration/backends
@haproxytechblog
haproxytechblog / blog20190705-01.sh
Last active September 17, 2019 15:30
Dissecting the HAProxy Kubernetes Ingress Controller
kubectl apply -f https://raw.githubusercontent.com/haproxytech/kubernetes-ingress/master/deploy/haproxy-ingress.yaml
@haproxytechblog
haproxytechblog / blog20190712-01.cfg
Last active September 12, 2021 01:57
HAProxy Layer 7 Retries and Chaos Engineering
backend be_servers
balance roundrobin
server s1 server1:80 maxconn 10
server s2 server2:80 maxconn 10
server s3 server3:80 maxconn 10
@haproxytechblog
haproxytechblog / blog20171011-01.cfg
Last active October 11, 2019 16:20
HAProxy SSL Termination
frontend www.mysite.com
bind 10.0.0.3:80
bind 10.0.0.3:443 ssl crt /etc/ssl/certs/mysite.pem
default_backend web_servers
@haproxytechblog
haproxytechblog / blog20190723-01.sh
Last active September 4, 2019 15:20
HAProxy Traffic Mirroring for Real-world Testing
$ sudo apt update
$ sudo apt install -y autoconf automake build-essential git libcurl4-openssl-dev libev-dev libpthread-stubs0-dev pkg-config
$ git clone https://github.com/haproxytech/spoa-mirror
$ cd spoa-mirror
$ ./scripts/bootstrap
$ ./configure
$ make all
$ sudo cp ./src/spoa-mirror /usr/local/bin/
@haproxytechblog
haproxytechblog / blog20190730-01.cfg
Last active September 28, 2022 14:50
Four Examples of HAProxy Rate Limiting
backend servers
server s1 192.168.30.10:80 check maxconn 30
server s2 192.168.31.10:80 check maxconn 30
server s3 192.168.31.10:80 check maxconn 30
@haproxytechblog
haproxytechblog / blog20190724-01.txt
Last active August 27, 2019 20:35
DNS for Service Discovery in HAProxy
_service._proto.name. TTL class SRV priority weight port target
@haproxytechblog
haproxytechblog / blog20190830-01.cfg
Last active February 15, 2022 20:54
Enabling CORS in HAProxy
frontend www
bind :80
# Add a response header
http-response add-header X-XSS-Protection "1; mode=block"
# Remove a response header
http-response del-header X-Powered-By
# Change a response header
@haproxytechblog
haproxytechblog / blog20191008-01.sh
Last active March 27, 2024 20:59
HAProxy and Docker Swarm
$ apt update
$ apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ apt update
$ apt install docker-ce docker-ce-cli containerd.io
@haproxytechblog
haproxytechblog / blog20191129-01.cfg
Last active November 29, 2019 17:08
HAProxy 2.1: Supercharged Performance and a Cleaner Codebase
global
h1-case-adjust content-length Content-Length