skills/api-gateway-reverse-proxy-expert/SKILL.md
API gateway and reverse proxy configuration with Kong, Nginx, Traefik, routing, and auth middleware. Activate on: API gateway, reverse proxy, Kong, Nginx, Traefik, load balancer, ingress, auth middleware. NOT for: rate limiting algorithms (use api-rate-limiting-throttling-expert), service mesh (use service-mesh-microservices-expert).
npx skillsauth add curiositech/windags-skills api-gateway-reverse-proxy-expertInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Configure and optimize API gateways and reverse proxies for routing, authentication, rate limiting, and traffic management.
Traffic Pattern & Requirements
├── Internal services only
│ └── API Key authentication
│ ├── Low complexity, fast validation
│ └── Kong: key-auth plugin, Traefik: forwardAuth
├── Customer-facing API with session needs
│ └── JWT authentication
│ ├── Stateless, includes user claims
│ └── Kong: jwt plugin, Nginx: lua-resty-jwt
├── Enterprise B2B integration
│ └── mTLS authentication
│ ├── Certificate-based, highest security
│ └── Kong: mtls-auth, Nginx: ssl_verify_client
└── Third-party SaaS integration
└── OAuth2 flow
├── Token exchange, delegated auth
└── Kong: oauth2 plugin, AWS API Gateway: authorizer
Requirements → Choice
├── Plugin ecosystem & GUI needed
│ └── Kong Enterprise/OSS
├── Kubernetes-native with auto-discovery
│ └── Traefik v3 or Ingress-NGINX
├── Maximum performance, minimal features
│ └── Nginx or Envoy
└── Cloud-managed, serverless scaling
└── AWS API Gateway or Azure Application Gateway
Service Architecture → Routing Method
├── Microservices with service discovery
│ └── Dynamic upstream targets
│ ├── Consul/Eureka integration
│ └── Health check based load balancing
├── Static backend services
│ └── Fixed upstream pools
│ ├── Round-robin or least-connections
│ └── Weighted routing for canary deployments
└── Multi-region deployment
└── Geographic routing
├── Latency-based or geo-IP
└── Fallback to secondary regions
Symptom: Slow API responses (>10s) under load
Detection: Response times spike while upstream services report normal latency
Root Cause: Gateway timeout higher than upstream timeout, causing request queuing
Fix: Set gateway read timeout < upstream timeout (gateway: 30s, upstream: 25s)
Symptom: Unauthorized requests reaching backend services
Detection: Backend logs show requests without expected auth headers
Root Cause: Route order allows permissive rules to match before auth rules
Fix: Move auth middleware to global level or ensure specific routes come first in config
Symptom: Intermittent 503 errors during traffic spikes
Detection: Circuit breaker opens/closes rapidly (multiple times per minute)
Root Cause: Threshold too sensitive or health check misconfigured
Fix: Tune failure threshold (5+ failures) and recovery time (30s minimum)
Symptom: HTTPS handshake failures, browser certificate warnings
Detection: SSL cert check shows expiry within 30 days
Root Cause: Manual certificate management without renewal automation
Fix: Implement cert-manager (K8s) or ACME client with auto-renewal
Symptom: Gateway stops accepting connections, memory/CPU at 100%
Detection: Connection refused errors, gateway health checks failing
Root Cause: No connection limits or memory leaks in plugins
Fix: Set worker_connections (Nginx) or connection pool limits (Kong), restart gateway
Context: Deploy Kong for microservices handling orders, inventory, payments with JWT auth
Step 1: Route Definition
# Identify service endpoints first
services:
- orders: /api/v1/orders/* → http://orders:8080
- inventory: /api/v1/inventory/* → http://inventory:8080
- payments: /api/v1/payments/* → http://payments:8080
Step 2: Apply Decision Tree
Step 3: Plugin Ordering
# Apply plugins in correct order
plugins:
1. cors (pre-auth)
2. jwt (authentication)
3. rate-limiting (post-auth)
4. request-transformer (last)
Expert vs Novice:
Situation: Deployed 20% traffic to new orders service version, seeing 500 errors
Detection Process:
Rollback Procedure:
# Step 1: Immediate traffic shift
kong:
routes:
- service: orders-v1
weight: 100 # Was 80
- service: orders-v2
weight: 0 # Was 20
# Step 2: Validate rollback
curl -H "Authorization: Bearer $JWT" \
https://api.company.com/orders/health
# Step 3: Remove failed upstream
kubectl scale deployment orders-v2 --replicas=0
Root Cause Analysis: New version had database connection pool misconfiguration, causing timeouts under load
This skill handles: Gateway configuration, routing rules, authentication middleware, reverse proxy setup
NOT for:
api-rate-limiting-throttling-expertservice-mesh-microservices-expertapi-architectdatabase-performance-expertkubernetes-expert or docker-expertsecurity-infrastructure-expertDelegation Rules:
tools
Building resilient distributed systems with circuit breakers, retries with full-jitter exponential backoff, retry budgets (per-request 3-attempt + per-client 10% ratio per Google SRE), deadline propagation, and the cascading-failure math (4 layers × 3 retries = 64x amplification). Grounded in Resilience4j, Microsoft Cloud Patterns, AWS Architecture Blog (Marc Brooker), and Google SRE Book.
testing
Designing HTTP cache headers that work correctly across browsers, CDNs, and shared proxies — `Cache-Control` directives per RFC 9111, `stale-while-revalidate` and `stale-if-error` per RFC 5861, the Vary header for varying responses, and surrogate keys for tag-based purging. Grounded in IETF RFCs and Cloudflare/Fastly docs.
development
Use when designing or fixing a Content Security Policy on a real site, choosing between nonce-based and hash-based CSP, adding strict-dynamic, debugging "Refused to execute inline script" errors, deploying CSP in report-only mode first, configuring report-to / report-uri, or auditing an existing policy for unsafe-inline / unsafe-eval / wildcards. Triggers: "CSP blocks legitimate inline script", strict-dynamic, nonce-{RANDOM}, sha256-{HASH}, object-src none, base-uri none, frame-ancestors, Trusted Types, X-Content-Security-Policy obsolete, report-only vs enforced. NOT for general HTTP security headers (HSTS, COOP/COEP), Trusted Types deep dive, CORS configuration, or building a WAF.
tools
Choosing and operating an HTTP API versioning strategy that doesn't break clients — Stripe's date-based pinned versions, the Deprecation/Sunset header pair (RFC 9745 + RFC 8594), URI vs header vs media-type approaches, and the version-transformer pattern. Grounded in Stripe's published architecture and IETF RFCs.