MCP HubMCP Hub
SKILL·A918C7

configure-reverse-proxy

pjt222
Actualizado 1 month ago
9 vistas
26
3
26
Ver en GitHub
Documentacióngeneral

Acerca de

Esta habilidad configura configuraciones de proxy inverso para Nginx, Traefik y ShinyProxy, manejando proxy de WebSocket, enrutamiento y terminación SSL. Úsala para enrutar múltiples servicios a través de un único punto de entrada, descubrir automáticamente servicios Docker con Traefik, o agregar TLS a servicios sin soporte nativo. Es ideal para desarrolladores que necesitan gestionar el tráfico para aplicaciones en contenedores o aplicaciones web como Shiny.

Instalación rápida

Claude Code

Recomendado
Principal
npx skills add pjt222/agent-almanac -a claude-code
Comando PluginAlternativo
/plugin add https://github.com/pjt222/agent-almanac
Git CloneAlternativo
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/configure-reverse-proxy

Copia y pega este comando en Claude Code para instalar esta habilidad

Documentación

Configure Reverse Proxy

Set up reverse proxy patterns for routing traffic to backend services w/ Nginx, Traefik, or ShinyProxy.

Use When

  • Route multi services behind single entry point
  • Proxy WebSocket connections (Shiny, Socket.IO, live reload)
  • Auto-discover Docker services w/ Traefik labels
  • Path-based / host-based routing to diff backends
  • Add SSL termination to services that don't handle TLS

In

  • Required: Backend services to proxy (host:port)
  • Required: Routing strategy (path-based, host-based, or both)
  • Optional: Proxy tool preference (Nginx, Traefik)
  • Optional: Domain name(s) for host-based routing
  • Optional: WebSocket endpoints to proxy

Do

Step 1: Choose Proxy Tool

FeatureNginxTraefik
ConfigurationStatic filesDocker labels / dynamic
Auto-discoveryNo (manual)Yes (Docker provider)
Let's EncryptVia certbotBuilt-in ACME
DashboardNo (3rd party)Built-in
WebSocketManual configAutomatic
Best forStatic config, high trafficDynamic Docker environments

Step 2: Nginx — Path-Based Routing

server {
    listen 80;

    location /api/ {
        proxy_pass http://api:8000/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }

    location /app/ {
        proxy_pass http://webapp:3000/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }

    location / {
        root /usr/share/nginx/html;
        try_files $uri $uri/ /index.html;
    }
}

Note: Trailing / on proxy_pass strips location prefix. proxy_pass http://api:8000/; w/ location /api/ forwards /api/users as /users.

Step 3: Nginx — Host-Based Routing

server {
    listen 80;
    server_name api.example.com;

    location / {
        proxy_pass http://api:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

server {
    listen 80;
    server_name app.example.com;

    location / {
        proxy_pass http://webapp:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Step 4: Nginx — WebSocket Proxying

WebSockets require upgrade headers. Essential for Shiny, Socket.IO, live reload:

location /ws/ {
    proxy_pass http://app:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_read_timeout 86400;
}

For Shiny apps specifically:

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

server {
    location / {
        proxy_pass http://shiny:3838;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Host $host;
        proxy_read_timeout 86400;
        proxy_buffering off;
    }
}

WebSocket connections establish + persist.

If err: Check proxy_http_version 1.1 set. Valid. Upgrade + Connection headers.

Step 5: Traefik — Docker Label Auto-Discovery

docker-compose.yml:

services:
  traefik:
    image: traefik:v3.2
    command:
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "[email protected]"
      - "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
      - "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - letsencrypt:/letsencrypt

  api:
    image: myapi:latest
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.api.rule=Host(`api.example.com`)"
      - "traefik.http.routers.api.entrypoints=websecure"
      - "traefik.http.routers.api.tls.certresolver=letsencrypt"
      - "traefik.http.services.api.loadbalancer.server.port=8000"

  webapp:
    image: myapp:latest
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.webapp.rule=Host(`app.example.com`)"
      - "traefik.http.routers.webapp.entrypoints=websecure"
      - "traefik.http.routers.webapp.tls.certresolver=letsencrypt"
      - "traefik.http.services.webapp.loadbalancer.server.port=3000"

volumes:
  letsencrypt:

Traefik auto-discovers services via labels, provisions SSL certs.

Step 6: Traefik — Path-Based Routing w/ Labels

services:
  api:
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.api.rule=Host(`example.com`) && PathPrefix(`/api`)"
      - "traefik.http.routers.api.middlewares=strip-api"
      - "traefik.http.middlewares.strip-api.stripprefix.prefixes=/api"
      - "traefik.http.services.api.loadbalancer.server.port=8000"

Step 7: Traefik — Rate Limiting + Headers

labels:
  - "traefik.http.middlewares.ratelimit.ratelimit.average=100"
  - "traefik.http.middlewares.ratelimit.ratelimit.burst=50"
  - "traefik.http.middlewares.security.headers.stsSeconds=63072000"
  - "traefik.http.middlewares.security.headers.contentTypeNosniff=true"
  - "traefik.http.middlewares.security.headers.frameDeny=true"
  - "traefik.http.routers.app.middlewares=ratelimit,security"

Step 8: Verify Proxy Configuration

# Nginx: test config
docker compose exec nginx nginx -t

# Check routing
curl -H "Host: api.example.com" http://localhost/health

# Check WebSocket (needs wscat: npm install -g wscat)
wscat -c ws://localhost/ws/

# Traefik dashboard (if enabled)
# http://localhost:8080/dashboard/

Reqs route to correct backends. WebSocket upgrades succeed.

Check

  • HTTP reqs route to correct backend by path or host
  • WebSocket connections establish + maintain
  • SSL termination works (if config'd)
  • Backend services receive correct Host, X-Real-IP, X-Forwarded-For headers
  • Traefik auto-discovers new services via labels (if using Traefik)
  • Config survives docker compose restart

Traps

  • Trailing slash mismatch: proxy_pass http://app/ vs http://app behaves differently w/ path stripping in Nginx.
  • WebSocket timeout: Default proxy_read_timeout = 60s. Long-lived WebSocket connections need 86400 (24h).
  • Docker socket security: Mounting /var/run/docker.sock in Traefik gives full Docker access. Use ro mount + consider socket proxy.
  • DNS resolution: Nginx resolves upstreams at startup. Use resolver 127.0.0.11 for Docker's internal DNS w/ dynamic services.
  • Missing proxy_buffering off: Shiny + SSE endpoints need proxy_buffering off for real-time streaming.

  • configure-nginx - detailed Nginx config w/ SSL + security headers
  • deploy-shinyproxy - ShinyProxy for containerized Shiny app hosting
  • setup-compose-stack - compose stack using reverse proxy
  • configure-api-gateway - API gateway patterns w/ Kong + Traefik

Repositorio GitHub

pjt222/agent-almanac
Ruta: i18n/caveman-ultra/skills/configure-reverse-proxy
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams
FAQ

Frequently asked questions

What is the configure-reverse-proxy skill?

configure-reverse-proxy is a Claude Skill by pjt222. Skills package instructions and resources that Claude loads on demand, so Claude can perform configure-reverse-proxy-related tasks without extra prompting.

How do I install configure-reverse-proxy?

Use the install commands on this page: add configure-reverse-proxy to Claude Code as a plugin, or clone its repository into your skills directory, then restart Claude so it picks up the skill.

What category does configure-reverse-proxy belong to?

configure-reverse-proxy is in the Documentation category, tagged general.

Is configure-reverse-proxy free to use?

Yes. configure-reverse-proxy is listed on AIMCP and free to install. It runs inside Claude, so no separate service account is required to use the skill itself.

Habilidades relacionadas

railway-docs
Documentación

Esta habilidad obtiene la documentación actual de Railway para responder preguntas sobre características, funcionalidad o URLs específicas de documentación. Garantiza que los desarrolladores reciban información precisa y actualizada directamente de las fuentes oficiales de Railway. Úsala cuando los usuarios pregunten cómo funciona Railway o hagan referencia a la documentación de Railway.

Ver habilidad
n8n-code-python
Documentación

Esta Skill de Claude proporciona orientación experta para escribir código Python en los nodos Code de n8n, específicamente para usar la biblioteca estándar de Python y trabajar con la sintaxis especial de n8n como `_input`, `_json` y `_node`. Ayuda a los desarrolladores a comprender las limitaciones de Python dentro de n8n y recomienda usar JavaScript para la mayoría de los flujos de trabajo, mientras ofrece soluciones en Python para necesidades específicas de transformación de datos.

Ver habilidad
archon
Documentación

La habilidad Archon proporciona búsqueda semántica con tecnología RAG y gestión de proyectos a través de una API REST. Úsala para consultar documentación, gestionar proyectos/tareas jerárquicos y realizar recuperación de conocimiento con capacidades de carga de documentos. Prioriza siempre a Archon en primer lugar al buscar en documentación externa antes de utilizar otras fuentes.

Ver habilidad
n8n-code-javascript
Documentación

Esta habilidad de Claude proporciona orientación experta para escribir código JavaScript en los nodos de Código de n8n. Cubre sintaxis esencial específica de n8n como las variables `$input`/`$json`, ayudantes HTTP y manejo de DateTime, mientras soluciona errores comunes. Úsela al desarrollar flujos de trabajo en n8n que requieran procesamiento personalizado de JavaScript en los nodos de Código.

Ver habilidad