[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EFDCVTQAXMF7Z5G6SXQBPN":3,"skill-same:01M6EFDCVTQAXMF7Z5G6SXQBPN":60},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M6EFDCVTQAXMF7Z5G6SXQBPN","load-balancer",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fload-balancer\u002FSKILL.md",[],[18],"load balancer","2026-11-10 10:12:30",false,"# Load Balancer\n\n## Overview\n\nThis skill helps AI agents configure production-grade load balancers and reverse proxies. It covers Nginx and HAProxy setup, SSL termination, rate limiting, WebSocket proxying, health checks, and traffic routing strategies for web applications and APIs.\n\n## Instructions\n\n### Step 1: Choose Architecture\n\nDetermine the right setup based on requirements:\n- **Single service, HTTPS needed** → Nginx reverse proxy with SSL\n- **Multiple backends, different routing rules** → Nginx with upstream groups or HAProxy with ACLs\n- **TCP\u002FUDP traffic (databases, Redis)** → Nginx stream module or HAProxy TCP mode\n- **Need advanced health checks, circuit breaking** → HAProxy (more powerful health check DSL)\n- **Kubernetes** → Ingress controller (nginx-ingress or Traefik)\n\n### Step 2: Configure Nginx Reverse Proxy\n\nBasic reverse proxy with load balancing:\n\n```nginx\n# \u002Fetc\u002Fnginx\u002Fnginx.conf\nuser nginx;\nworker_processes auto;\nworker_rlimit_nofile 65535;\n\nevents {\n    worker_connections 4096;\n    multi_accept on;\n}\n\nhttp {\n    sendfile on;\n    tcp_nopush on;\n    tcp_nodelay on;\n    keepalive_timeout 65;\n    server_tokens off;\n\n    # Logging with upstream timing\n    log_format main '$remote_addr - $remote_user [$time_local] \"$request\" '\n                    '$status $body_bytes_sent \"$http_referer\" '\n                    '\"$http_user_agent\" $request_time $upstream_response_time';\n\n    # Gzip compression\n    gzip on;\n    gzip_vary on;\n    gzip_min_length 1024;\n    gzip_types text\u002Fplain text\u002Fcss application\u002Fjson application\u002Fjavascript\n               text\u002Fxml application\u002Fxml image\u002Fsvg+xml;\n\n    # Rate limiting zones\n    limit_req_zone $binary_remote_addr zone=api:10m rate=30r\u002Fs;\n    limit_req_zone $binary_remote_addr zone=login:10m rate=5r\u002Fm;\n\n    # Upstream backends\n    upstream app_servers {\n        least_conn;\n        keepalive 32;\n\n        server app1:8080 weight=3 max_fails=3 fail_timeout=30s;\n        server app2:8080 weight=3 max_fails=3 fail_timeout=30s;\n        server app3:8080 backup;\n    }\n\n    upstream websocket_servers {\n        ip_hash;\n        server ws1:8080;\n        server ws2:8080;\n    }\n\n    # Cache for static assets\n    proxy_cache_path \u002Fvar\u002Fcache\u002Fnginx levels=1:2 keys_zone=static_cache:10m\n                     max_size=1g inactive=60m use_temp_path=off;\n\n    include \u002Fetc\u002Fnginx\u002Fconf.d\u002F*.conf;\n}\n```\n\n### Step 3: Configure HTTPS and Security\n\n```nginx\n# \u002Fetc\u002Fnginx\u002Fconf.d\u002Fapp.conf\nserver {\n    listen 80;\n    server_name example.com;\n    return 301 https:\u002F\u002F$host$request_uri;\n}\n\nserver {\n    listen 443 ssl http2;\n    server_name example.com;\n\n    ssl_certificate \u002Fetc\u002Fletsencrypt\u002Flive\u002Fexample.com\u002Ffullchain.pem;\n    ssl_certificate_key \u002Fetc\u002Fletsencrypt\u002Flive\u002Fexample.com\u002Fprivkey.pem;\n    ssl_protocols TLSv1.2 TLSv1.3;\n    ssl_prefer_server_ciphers off;\n\n    # Security headers\n    add_header Strict-Transport-Security \"max-age=63072000; includeSubDomains\" always;\n    add_header X-Frame-Options DENY always;\n    add_header X-Content-Type-Options nosniff always;\n\n    # Static files with caching\n    location \u002Fstatic\u002F {\n        alias \u002Fvar\u002Fwww\u002Fstatic\u002F;\n        expires 1y;\n        add_header Cache-Control \"public, immutable\";\n        proxy_cache static_cache;\n    }\n\n    # API with rate limiting\n    location \u002Fapi\u002F {\n        limit_req zone=api burst=20 nodelay;\n\n        proxy_pass http:\u002F\u002Fapp_servers;\n        proxy_http_version 1.1;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n        proxy_set_header Connection \"\";\n\n        proxy_connect_timeout 5s;\n        proxy_read_timeout 30s;\n        proxy_next_upstream error timeout http_502 http_503;\n        proxy_next_upstream_tries 2;\n    }\n\n    # Auth — strict rate limit\n    location \u002Fapi\u002Fauth\u002Flogin {\n        limit_req zone=login burst=3 nodelay;\n        proxy_pass http:\u002F\u002Fapp_servers;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n    }\n\n    # WebSocket\n    location \u002Fws\u002F {\n        proxy_pass http:\u002F\u002Fwebsocket_servers;\n        proxy_http_version 1.1;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Connection \"upgrade\";\n        proxy_set_header Host $host;\n        proxy_read_timeout 3600s;\n    }\n\n    # Default\n    location \u002F {\n        proxy_pass http:\u002F\u002Fapp_servers;\n        proxy_http_version 1.1;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n    }\n\n    # Block attack paths\n    location ~ \u002F\\.(git|env|htaccess) {\n        deny all;\n        return 404;\n    }\n}\n```\n\n### Step 4: Configure HAProxy (Alternative)\n\nUse HAProxy when you need advanced health checks, stick tables for rate limiting, or a stats dashboard:\n\n```haproxy\n# \u002Fetc\u002Fhaproxy\u002Fhaproxy.cfg\nglobal\n    maxconn 50000\n    log stdout format raw local0\n    stats socket \u002Fvar\u002Frun\u002Fhaproxy.sock mode 660 level admin\n    ssl-default-bind-options ssl-min-ver TLSv1.2\n\ndefaults\n    mode http\n    log global\n    option httplog\n    option dontlognull\n    option forwardfor\n    timeout connect 5s\n    timeout client 30s\n    timeout server 30s\n    timeout http-request 10s\n\nfrontend stats\n    bind *:8404\n    stats enable\n    stats uri \u002Fstats\n    stats refresh 10s\n\nfrontend https_front\n    bind *:443 ssl crt \u002Fetc\u002Fhaproxy\u002Fcerts\u002Fexample.com.pem alpn h2,http\u002F1.1\n    http-request set-header X-Forwarded-Proto https\n\n    # ACL-based routing\n    acl is_api path_beg \u002Fapi\u002F\n    acl is_websocket hdr(Upgrade) -i websocket\n    acl is_static path_beg \u002Fstatic\u002F \u002Fassets\u002F\n\n    # Rate limiting with stick tables\n    stick-table type ip size 100k expire 30s store http_req_rate(10s)\n    http-request track-sc0 src\n    http-request deny deny_status 429 if { sc_http_req_rate(0) gt 100 }\n\n    use_backend ws_servers if is_websocket\n    use_backend api_servers if is_api\n    default_backend app_servers\n\nbackend app_servers\n    balance leastconn\n    option httpchk GET \u002Fhealth\n    http-check expect status 200\n    cookie SERVERID insert indirect nocache\n\n    server app1 app1:8080 check inter 5s fall 3 rise 2 cookie app1\n    server app2 app2:8080 check inter 5s fall 3 rise 2 cookie app2\n    server app3 app3:8080 check inter 5s fall 3 rise 2 backup\n\nbackend api_servers\n    balance leastconn\n    option httpchk GET \u002Fapi\u002Fhealth\n    default-server inter 3s fall 3 rise 2 slowstart 60s\n    retry-on conn-failure empty-response response-timeout\n    retries 2\n\n    server api1 api1:3000 check\n    server api2 api2:3000 check\n\nbackend ws_servers\n    balance source\n    timeout tunnel 3600s\n    server ws1 ws1:8080 check\n    server ws2 ws2:8080 check\n```\n\n### Step 5: Set Up SSL with Let's Encrypt\n\nInstall certbot (`apt install certbot python3-certbot-nginx`), run `certbot --nginx -d example.com`, and add a cron for auto-renewal: `0 3 * * * certbot renew --quiet --post-hook 'nginx -s reload'`.\n\n### Step 6: TCP\u002FUDP Load Balancing and Algorithms\n\nFor databases or Redis, use the Nginx `stream` block (outside `http`) with `proxy_pass` to upstream groups. Choose algorithms based on workload:\n\n- **round-robin** (default) — Equal distribution for stateless servers\n- **least_conn** — Fewest active connections, best for variable request durations\n- **ip_hash** — Sticky sessions by client IP for in-memory sessions\n- **hash $key consistent** — Minimizes redistribution when servers change (good for caches)\n\nHealth checks: Nginx uses passive checks (`max_fails=3 fail_timeout=30s`), while HAProxy uses active probes (`option httpchk GET \u002Fhealth` with `inter 5s fall 3 rise 2`).\n\n## Examples\n\n### Example 1: Set up Nginx reverse proxy with SSL for a Node.js app\n**User prompt:** \"Configure Nginx as a reverse proxy for my Node.js API running on ports 3000 and 3001 on two servers. Add SSL with Let's Encrypt for api.shopwise.io, rate limit the \u002Fapi\u002Fauth endpoints to 5 requests per minute, and proxy WebSocket connections on \u002Fws\u002F.\"\n\nThe agent will create an Nginx config with an `upstream api_backends` block using `least_conn` balancing across both servers. It will set up a server block listening on 443 with SSL certificates from Let's Encrypt, configure `proxy_pass` to the upstream with proper `X-Real-IP` and `X-Forwarded-For` headers, add a `limit_req_zone` for auth endpoints at 5r\u002Fm with burst of 3, and configure the `\u002Fws\u002F` location with `proxy_set_header Upgrade` and `Connection \"upgrade\"` for WebSocket support. It will also add an HTTP-to-HTTPS redirect on port 80 and install a certbot renewal cron job.\n\n### Example 2: Configure HAProxy with health checks and a stats dashboard\n**User prompt:** \"Set up HAProxy to load balance three backend servers for our e-commerce site at store.greenleaf.com. I need active health checks hitting \u002Fhealth every 5 seconds, sticky sessions for the cart, and access to the HAProxy stats page on port 8404.\"\n\nThe agent will write an HAProxy config with a `frontend https_front` bound to port 443 with SSL, routing to a `backend app_servers` using `leastconn` balancing. It will add `option httpchk GET \u002Fhealth` with `http-check expect status 200` and configure each server with `check inter 5s fall 3 rise 2`. For sticky sessions, it will add `cookie SERVERID insert indirect nocache` and assign cookie values to each server. The stats frontend will bind to port 8404 with `stats enable`, `stats uri \u002Fstats`, and `stats refresh 10s`.\n\n## Guidelines\n\n- Terminate SSL at the load balancer — simpler cert management, offloads crypto from backends\n- Always set `X-Real-IP` and `X-Forwarded-For` headers — backends need real client IPs\n- Use `least_conn` for APIs with variable response times\n- Configure `proxy_next_upstream` for transparent failover on 502\u002F503\n- Use keepalive connections to backends (`keepalive 32`) to reduce TCP overhead\n- Rate limit auth endpoints much more aggressively than general API endpoints\n- Log `$upstream_response_time` separately from `$request_time` to isolate backend vs network latency\n- Health check endpoints should test real dependencies (DB, cache), not just return 200\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FTerminalSkills\u002Fskills\u002Fload-balancer",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill load-balancer",{"tool":38,"command":39},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill load-balancer",{"tool":41,"command":42},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill load-balancer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fload-balancer\u002FSKILL.md",true,[46,52,56],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Fexamples.md","REFERENCE","参考文档",2320,"https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN\u002Fblob\u002Fmain\u002Fcore\u002Foptional-skills\u002Fmlops\u002Finstructor\u002Freferences\u002Fexamples.md",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Fproviders.md",1329,"https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN\u002Fblob\u002Fmain\u002Fcore\u002Foptional-skills\u002Fmlops\u002Finstructor\u002Freferences\u002Fproviders.md",{"path":57,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":58,"sourceHtmlUrl":59},"references\u002Fvalidation.md",15306,"https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002FWORM_V2_SOVEREIGN\u002Fblob\u002Fmain\u002Fcore\u002Foptional-skills\u002Fmlops\u002Finstructor\u002Freferences\u002Fvalidation.md",[61,75,85,94,100,107],{"skillNo":62,"name":63,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":71,"publishedAt":19},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[66],{"categoryNo":67,"categoryName":68,"taxonomyType":69,"taxonomyTypeDesc":70},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[72,73,74],"model","model hierarchy","model hierarchy skill",{"skillNo":76,"name":77,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":81,"publishedAt":19},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[80],{"categoryNo":67,"categoryName":68,"taxonomyType":69,"taxonomyTypeDesc":70},[82,83,84],"MCP","zoom","zoom mcp",{"skillNo":86,"name":87,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[91,92,93,83],"sdk","zoom apps sdk","apps",{"skillNo":95,"name":96,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":19},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[96],{"skillNo":101,"name":102,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":106,"publishedAt":19},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[105],{"categoryNo":67,"categoryName":68,"taxonomyType":69,"taxonomyTypeDesc":70},[102],{"skillNo":108,"name":109,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":19},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[109]]