AgentSkillsCN

managing-traefik

管理本地开发中的 Traefik 反向代理。适用于将域名路由至本地服务、配置 CORS、检查服务健康状况,或排查连接问题时使用。

SKILL.md
--- frontmatter
name: managing-traefik
description: Manages Traefik reverse proxy for local development. Use when routing domains to local services, configuring CORS, checking service health, or debugging connectivity issues.

Traefik Hub MCP

Local development reverse proxy management.

Quick Start

Generate Docker labels for a new service?

code
generate_labels name="myapp" domain="myapp.localhost" port=3000

Returns docker-compose label configuration to copy into your project.

Something not working?

code
doctor

Comprehensive health check with actionable tips.

Tool Categories

Project Setup

ToolUse When
generate_labelsCreating docker-compose labels for Docker services

CORS Management

ToolUse When
get_corsChecking current allowed origins
update_corsAdding/removing CORS origins

Health & Debugging

ToolUse When
doctorFirst step for any problem (comprehensive check)
check_healthTesting if specific domain responds
check_setupVerifying MCP configuration

Inspection

ToolUse When
list_routersSeeing all configured routes
list_servicesSeeing all backend services
list_middlewaresSeeing available middlewares
get_routerGetting details of specific route

Stack Control

ToolUse When
init_stackFirst time setup (creates network + starts Traefik)
start_traefikStarting stopped Traefik
stop_traefikStopping Traefik
create_networkCreating traefik-public network only

Common Workflows

New Project Setup

code
1. generate_labels name="myapp" domain="myapp.localhost" port=3000
2. update_cors add=["http://myapp.localhost"]

Add the generated labels to your project's docker-compose.yml, then update CORS if needed.

Debug Service Not Reachable

code
1. doctor                           # Check all components
2. check_health domain="X.localhost" # Test specific domain
3. list_routers                     # Verify route exists
4. container_logs name="traefik"    # Check Traefik logs

Add CORS Origin

code
1. get_cors                         # See current origins
2. update_cors add=["http://newapp.localhost"]

Generate Docker Labels

code
generate_labels name="myapp" domain="myapp.localhost" port=3000

Returns docker-compose label configuration to copy into your project.

Decision Guide

SituationTool
First time everinit_stack
New Docker servicegenerate_labels
CORS errorsget_corsupdate_cors
Service unreachabledoctor
Check specific domaincheck_health

Available Middlewares

Reference with @file suffix (e.g., cors-dev@file):

  • cors-dev - CORS headers for local development
  • secure-headers - Security headers
  • rate-limit - Rate limiting (100 req/s)
  • strip-api-prefix - Strip /api prefix from path