xiaohongshu
xiaohongshu
haproxy
HAProxy load balancer configuration and management. Set up TCP/HTTP load balancing, SSL termination, health checks, ACLs, and high availability. Use when working with HAProxy, load balancing, reverse proxy, TCP proxying, or high-traffic applications.
Full skill instructions
Configure and manage HAProxy for high-performance load balancing, SSL termination, and reverse proxying.
Use this skill when you see:
# /etc/haproxy/haproxy.cfg
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 4096
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
frontend http_front
bind *:80
default_backend http_back
option forwardfor
backend http_back
balance roundrobin
option httpchk GET /health
http-check expect status 200
server web1 192.168.1.10:8080 check
server web2 192.168.1.11:8080 check
server web3 192.168.1.12:8080 check backup
frontend https_front
bind *:443 ssl crt /etc/haproxy/certs/combined.pem
bind *:80
redirect scheme https code 301 if !{ ssl_fc }
default_backend https_back
# HSTS header
http-response set-header Strict-Transport-Security "max-age=31536000; includeSubDomains"
backend https_back
balance leastconn
option httpchk GET /health
server web1 192.168.1.10:8080 check
server web2 192.168.1.11:8080 check
frontend tcp_front
bind *:3306
mode tcp
default_backend mysql_back
backend mysql_back
mode tcp
balance roundrobin
option mysql-check user haproxy
server db1 192.168.1.20:3306 check
server db2 192.168.1.21:3306 check backup
frontend http_front
bind *:80
# Define ACLs
acl is_api path_beg /api
acl is_static path_beg /static
acl is_admin path_beg /admin
acl host_app hdr(host) -i app.example.com
acl host_api hdr(host) -i api.example.com
# Route based on ACLs
use_backend api_back if is_api
use_backend api_back if host_api
use_backend static_back if is_static
use_backend admin_back if is_admin
default_backend app_back
backend api_back
balance roundrobin
server api1 192.168.1.30:8080 check
server api2 192.168.1.31:8080 check
backend static_back
balance roundrobin
server static1 192.168.1.40:80 check
backend admin_back
balance roundrobin
server admin1 192.168.1.50:8080 check
backend app_back
balance roundrobin
server app1 192.168.1.10:8080 check
server app2 192.168.1.11:8080 check
backend http_back
# HTTP health check
option httpchk GET /health HTTP/1.1\r\nHost:\ localhost
http-check expect status 200
# Advanced health check
http-check send meth GET uri /health ver HTTP/1.1 hdr Host localhost
http-check expect status 200
server web1 192.168.1.10:8080 check inter 3000 fall 3 rise 2
server web2 192.168.1.11:8080 check inter 3000 fall 3 rise 2
backend tcp_back
mode tcp
option tcp-check
tcp-check connect
tcp-check send PING\r\n
tcp-check expect string +PONG
server redis1 192.168.1.60:6379 check
frontend http_front
bind *:80
# Define rate limit table
stick-table type ip size 100k expire 30s store http_req_rate(10s)
# Track requests per IP
http-request track-sc0 src
# Deny if rate exceeds 100 requests per 10 seconds
http-request deny deny_status 429 if { sc_http_req_rate(0) gt 100 }
default_backend http_back
backend app_back
balance roundrobin
cookie SERVERID insert indirect nocache
server web1 192.168.1.10:8080 check cookie web1
server web2 192.168.1.11:8080 check cookie web2
listen stats
bind *:8404
stats enable
stats uri /stats
stats refresh 10s
stats auth admin:password
stats admin if LOCALHOST
global
log 127.0.0.1:514 local0 info
log 127.0.0.1:514 local1 notice
defaults
log global
option httplog
option dontlognull
# Custom log format
log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
version: '3.8'
services:
haproxy:
image: haproxy:2.8
ports:
- "80:80"
- "443:443"
- "8404:8404"
volumes:
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
- ./certs:/etc/haproxy/certs:ro
restart: unless-stopped
networks:
- app-network
web1:
image: nginx:alpine
networks:
- app-network
web2:
image: nginx:alpine
networks:
- app-network
networks:
app-network:
driver: bridge
# Check configuration
haproxy -c -f /etc/haproxy/haproxy.cfg
# Reload configuration (graceful)
sudo systemctl reload haproxy
# View stats via socket
echo "show stat" | sudo socat stdio /run/haproxy/admin.sock
# Disable server
echo "disable server http_back/web1" | sudo socat stdio /run/haproxy/admin.sock
# Enable server
echo "enable server http_back/web1" | sudo socat stdio /run/haproxy/admin.sock
# View server status
echo "show servers state" | sudo socat stdio /run/haproxy/admin.sock
apt install haproxyhaproxy -c -f /etc/haproxy/haproxy.cfgsystemctl start haproxycat cert.pem key.pem > combined.pemxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience