Skip to content

Instantly share code, notes, and snippets.

@haproxytechblog
haproxytechblog / blog20210405-01.sh
Created April 5, 2021 15:25
HAProxy Forwards Over 2 Million HTTP Requests per Second on a single AWS Arm Instance
$ lscpu -e
CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE
0 0 0 0 0:0:0:0 yes
1 0 0 1 1:1:1:0 yes
2 0 0 2 2:2:2:0 yes
3 0 0 3 3:3:3:0 yes
...
60 0 0 60 60:60:60:0 yes
61 0 0 61 61:61:61:0 yes
@haproxytechblog
haproxytechblog / blog20210325-01.cfg
Last active March 29, 2021 13:41
HAProxy Enterprise 2.3 and HAProxy 2.4 Support the Financial Information eXchange Protocol (FIX)
frontend fix_listener
mode tcp
bind :443 ssl crt /etc/haproxy/certs/cert.pem ssl-min-ver TLSv1.2
default_backend fix_servers
@haproxytechblog
haproxytechblog / blog20210312-01.sh
Last active March 30, 2021 17:33
Using HAProxy as an API Gateway, Part 5 [Monetization]
$ git clone https://github.com/haproxytechblog/haproxy-api-monetization-demo.git
$ cd haproxy-api-monetization-demo
$ sudo docker-compose up -d
@haproxytechblog
haproxytechblog / blog20210303-01.sh
Last active March 4, 2021 22:00
The HAProxy Enterprise WAF
$ python /usr/bin/sqlmap \
--random-agent \
--cookie="PHPSESSID={YOUR SESSION ID};security=low" \
--dbs \
--url="http://{YOUR SITE IP}/vulnerabilities/sqli/?id=&Submit=Submit" \
-p id
@haproxytechblog
haproxytechblog / blog20210219-01.sh
Last active February 19, 2021 14:22
Logging with the HAProxy Kubernetes Ingress Controller
$ kubectl logs haproxy-kubernetes-ingress-6bbb4f9f5f-lt8j
2021/02/03 17:19:42 HAProxy Ingress Controller v1.5.0 a5e81ae
2021/02/03 17:19:42 Build from: git@github.com:haproxytech/kubernetes-ingress.git
2021/02/03 17:19:42 Build date: 2021-01-21T10:15:17
2021/02/03 17:19:42 ConfigMap: default/haproxy-kubernetes-ingress
2021/02/03 17:19:42 Ingress class:
2021/02/03 17:19:42 Publish service:
2021/02/03 17:19:42 Default backend service: default/haproxy-kubernetes-ingress-default-backend
@haproxytechblog
haproxytechblog / blog20210208-01.cfg
Last active March 25, 2026 15:11
Using HAProxy as an API Gateway, Part 4 Metrics
frontend stats
bind :8404
stats enable
stats uri /
stats refresh 10s
@haproxytechblog
haproxytechblog / blog20210202-01.cfg
Last active February 18, 2023 22:49
How to Map Domain Names to Backend Server Pools with HAProxy
frontend default
bind :80
# ACL for "example.com" and "www.example.com"
acl ACL_example.com hdr(host) -i example.com www.example.com
use_backend be_example.com if ACL_example.com
# ACL for "example.net"
acl ACL_example.net hdr(host) -i example.net
use_backend be_example.net if ACL_example.net
@haproxytechblog
haproxytechblog / blog20210129-01.cfg
Created January 29, 2021 15:20
HAProxy Connection Limits and Queues
global
maxconn 60000
@haproxytechblog
haproxytechblog / blog20210119-01.yaml
Last active January 22, 2021 15:36
Announcing HAProxy Kubernetes Ingress Controller 1.5
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: web-ingress
namespace: default
annotations:
haproxy.org/ssl-redirect: "true"
haproxy.org/ssl-redirect-code: "301"
haproxy.org/ssl-certificate: "default/tls-secret"
# ... other ingress settings...
@haproxytechblog
haproxytechblog / blog20210114-01.sh
Last active May 23, 2021 11:17
Announcing HAProxy Data Plane API 2.2
$ curl -u dataplaneapi:mypassword \
-H 'Content-Type: application/json' \
-d '{
"name": "consul-server",
"address": "consul.local",
"port": 8500,
"enabled": true,
"retry_timeout": 10
}' http://localhost:5555/v2/service_discovery/consul