Przejdź do treści
Biblioteka skilli
DevOps i chmura · Budowanie i kod

haproxy

/haproxy

Wspiera konfigurację load balancera HAProxy: routing warstwy 4 i 7, health checki, terminacja SSL i rate limiting dla proxy o wysokiej dostępności i niskich opóźnieniach.

Repozytorium
Agent-Skills ↗
Licencja
MIT
Ostatnia zmiana repozytorium
01.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 01.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Wspiera konfigurację load balancera HAProxy: routing warstwy 4 i 7, health checki, terminacja SSL i rate limiting dla proxy o wysokiej dostępności i niskich opóźnieniach.

Oryginalny opis (EN)

Expert HAProxy load balancer assistance covering Layer 4 / Layer 7 routing, health checks, SSL termination, and rate limiting. Use when building high-availability, low-latency traffic proxies.

Jak działa

  1. When to Use
  2. Quick Start
  3. Core Concepts
  4. Common Patterns
  5. Best Practices
  6. Troubleshooting
  7. References
Sekcje z nagłówków SKILL.md, w oryginale · 158 linii, 618 słów
Podgląd SKILL.md
---
name: haproxy
description: Expert HAProxy load balancer assistance covering Layer 4 / Layer 7 routing, health checks, SSL termination, and rate limiting. Use when building high-availability, low-latency traffic proxies.
---

# HAProxy

HAProxy is a high-availability, high-performance TCP/HTTP load balancer and proxying solution, offering ultra-low latency traffic routing, SSL termination, and robust health checking.

## When to Use

- **High-Performance Layer 4 & Layer 7 Load Balancing**: Distributing millions of concurrent TCP/HTTP connections with low CPU overhead.
- **TLS Termination & SSL Offloading**: Offloading cryptographic handshakes at the edge before proxying to backend servers.
- **Advanced Rate Limiting & Stick Tables**: Tracking client IPs across sliding time windows to neutralize DDoS and brute force.
- **Health Checking & Circuit Breaking**: Detecting unhealthy backend servers and rerouting traffic instantaneously.

## Quick Start

```haproxy
frontend http_front
   bind *:80
   default_backend web_servers

backend web_servers
   balance roundrobin
   server web1 10.0.0.1:80 check
   server web2 10.0.0.2:80 check
```

## Core Concepts

### Production HTTP Load Balancer Configuration

Configuring frontend and backend pools with health checks:

```haproxy
# /etc/haproxy/haproxy.cfg
global
    log /dev/log local0
    maxconn 50000
    user haproxy
    group haproxy
    daemon
    ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384
    ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets

defaults
    log     global
    mode    http
    option  httplog
    option  dontlognull
    timeout connect 5000ms
    timeout client  50000ms
    timeout server  50000ms

frontend http_front
    bind *:80
    bind *:443 ssl crt /etc/ssl/certs/example.com.pem alpn h2,http/1.1
    redirect scheme https code 301 if !{ ssl_fc }

    # Rate limiting stick-table: 100 requests per 10 seconds per IP
    stick-table type ip size 100k expire 30s store http_req_rate(10s)
    http-request track-sc0 src
    http-request deny deny_status 429 if { sc_http_req_rate(0) gt 100 }

    default_backend web_cluster

backend web_cluster
    balance roundrobin
    option httpchk GET /healthz
    http-check expect status 200
    cookie SERVERID insert indirect nocache

    server web1 10.0.1.10:8080 check cookie web1 fall 3 rise 2
    server web2 10.0.1.11:8080 check cookie web2 fall 3 rise 2
```

### TCP Layer 4 Load Balancing (Database Proxy)

Distributing MySQL or PostgreSQL connections across read replicas:

```haproxy
frontend db_in
    bind *:5432
    mode tcp
    option tcplog
    default_backend db_replicas

backend db_replicas
    mode tcp
    balance leastconn
    option tcp-check
    server db-replica-1 10.0.2.20:5432 check
    server db-replica-2 10.0.2.21:5432 check
```

### Statistics Dashboard Configuration

Enabling real-time traffic monitoring interface:

```haproxy
listen stats
    bind *:8404
    mode http
    stats enable
    stats uri /
    stats refresh 5s
    stats auth admin:SuperSecretPassword2026
```

## Common Patterns

### Layer 7 Round-Robin Backend with Active Health Checks

**Problem**: Distributing web traffic across backend workers while automatically evicting degraded instances.

**Solution**:
Configure `haproxy.cfg` frontend and backend:

```haproxy
frontend http_front
    bind *:80
    bind *:443 ssl crt /etc/ssl/certs/site.pem
    redirect scheme https if !{ ssl_fc }
    default_backend web_servers

backend web_servers
    balance roundrobin
    cookie SERVERID insert indirect nocache
    option httpchk GET /health
    http-check expect status 200
    server app01 10.0.0.10:8080 check cookie app01
    server app02 10.0.0.11:8080 check cookie app02
```

## Best Practices

**Do**:

- Test HAProxy configuration files (`haproxy -c -f /etc/haproxy/haproxy.cfg`) before reloading.
- Use `balance leastconn` for long-running connections (WebSockets, database pools) and `roundrobin` for short HTTP APIs.
- Configure `stick-table` to defend endpoints against brute-force attacks and volumetric DDoS.
- Configure `option httpchk` to verify that application backends are genuinely healthy before routing traffic.

**Don't**:

- Run HAProxy with single-threaded defaults on multi-core servers; configure `nbthread` or multi-threading.
- Leave stats dashboards accessible without authentication or IP restrictions.
- Set excessively low client/server timeouts that sever legitimate long-polling or file upload connections.

## Troubleshooting

| Error                                                                    | Cause                                              | Solution                                                               |
| :----------------------------------------------------------------------- | :------------------------------------------------- | :--------------------------------------------------------------------- |
| `[ALERT] 085/120000 : parsing [haproxy.cfg:20] : syntax error`           | Indentation or syntax error in configuration line. | Run `haproxy -c -f /etc/haproxy/haproxy.cfg` to validate syntax.       |
| `503 Service Unavailable: No server is available to handle this request` | All backend servers failed health checks.          | Check backend server health logs and verify `option httpchk` endpoint. |
| `Cannot bind socket [0.0.0.0:80]`                                        | Port 80 bound by another service.                  | Kill conflicting service or configure HAProxy on custom port.          |

## References

- [HAProxy Documentation](https://www.haproxy.org/)

Wersje

RepozytoriumWynikLicencja
Ta strona · G1Joshi/Agent-Skills100MIT
chrishuffman5/domain-expert100MIT

Migawka bazy z 13.11.2026 · wersja paczki b97ed9c031fe (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 1 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100load-balancer
    Konfiguruje load balancery i reverse proxy z Nginx i HAProxy: pule upstream, równoważenie najmniejszą liczbą połączeń, terminacja HTTPS, kontrole stanu, limity ruchu, sticky sessions i proxy WebSocket.
  • 100load-balancer
    Opisuje równoważenie obciążenia z Nginx i HAProxy: konfigurację upstream, algorytmy, kontrole stanu, terminację SSL, trwałość sesji i monitoring.
  • 100reverse-proxy
    Konfiguruje i diagnozuje odwrotne proxy Nginx, Traefik lub HAProxy: routing, terminację SSL i błędy w konfiguracji.
  • 100configuring-load-balancers
    Konfiguruje load balancery (ALB, NLB, Nginx, HAProxy) i generuje gotowe do produkcji konfiguracje z health checkami, terminacją SSL, sesjami sticky i regułami rozdziału ruchu.
  • 100configuring-load-balancers
    Konfiguruje load balancery (ALB, NLB, Nginx, HAProxy) i generuje gotowe do produkcji konfiguracje z health checkami, terminacją SSL, sesjami sticky i regułami rozdziału ruchu.
  • 100api-gateway
    Wspiera architekturę bramy API: reverse proxy, routing żądań, limity, delegowanie uwierzytelniania i terminacja SSL, z Kong, Envoy i Traefik.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.