fix: настроен trust proxy для n8n за Traefik
Добавлена переменная N8N_PROXY_HOPS=1 для корректной работы n8n за reverse proxy (Traefik). Это устраняет ValidationError "The 'X-Forwarded-For' header is set but the Express 'trust proxy' setting is false" при работе express-rate-limit. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
51969ba447
commit
610a45dc60
1 changed files with 57 additions and 4 deletions
|
|
@ -41,6 +41,12 @@ services:
|
|||
N8N_BASIC_AUTH_ACTIVE: 'false'
|
||||
N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY}
|
||||
N8N_PAYLOAD_SIZE_MAX: 64
|
||||
|
||||
# Proxy configuration (for Traefik)
|
||||
N8N_PROXY_HOPS: '1'
|
||||
|
||||
# Community Packages
|
||||
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE: 'true'
|
||||
|
||||
# Performance
|
||||
EXECUTIONS_DATA_PRUNE: 'true'
|
||||
|
|
@ -85,6 +91,12 @@ services:
|
|||
- "traefik.http.routers.n8n-shared.tls.certresolver=cloudflare"
|
||||
- "traefik.http.routers.n8n-shared.service=n8n-shared-service"
|
||||
- "traefik.http.routers.n8n-shared.priority=50"
|
||||
- "traefik.http.routers.n8n-shared.middlewares=n8n-nocache"
|
||||
|
||||
# Middleware для отключения кэширования
|
||||
- "traefik.http.middlewares.n8n-nocache.headers.customresponseheaders.Cache-Control=no-cache, no-store, must-revalidate"
|
||||
- "traefik.http.middlewares.n8n-nocache.headers.customresponseheaders.Pragma=no-cache"
|
||||
- "traefik.http.middlewares.n8n-nocache.headers.customresponseheaders.Expires=0"
|
||||
|
||||
# Сервис
|
||||
- "traefik.http.services.n8n-shared-service.loadbalancer.server.port=5678"
|
||||
|
|
@ -119,9 +131,12 @@ services:
|
|||
|
||||
# Worker settings
|
||||
N8N_CONCURRENCY_PRODUCTION_LIMIT: 20
|
||||
|
||||
|
||||
# Security
|
||||
N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY}
|
||||
|
||||
# Community Packages
|
||||
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE: 'true'
|
||||
|
||||
# Timezone
|
||||
GENERIC_TIMEZONE: Europe/London
|
||||
|
|
@ -169,9 +184,12 @@ services:
|
|||
|
||||
# Worker settings
|
||||
N8N_CONCURRENCY_PRODUCTION_LIMIT: 20
|
||||
|
||||
|
||||
# Security
|
||||
N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY}
|
||||
|
||||
# Community Packages
|
||||
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE: 'true'
|
||||
|
||||
# Timezone
|
||||
GENERIC_TIMEZONE: Europe/London
|
||||
|
|
@ -219,9 +237,12 @@ services:
|
|||
|
||||
# Worker settings
|
||||
N8N_CONCURRENCY_PRODUCTION_LIMIT: 15
|
||||
|
||||
|
||||
# Security
|
||||
N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY}
|
||||
|
||||
# Community Packages
|
||||
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE: 'true'
|
||||
|
||||
# Timezone
|
||||
GENERIC_TIMEZONE: Europe/London
|
||||
|
|
@ -269,9 +290,12 @@ services:
|
|||
|
||||
# Worker settings
|
||||
N8N_CONCURRENCY_PRODUCTION_LIMIT: 15
|
||||
|
||||
|
||||
# Security
|
||||
N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY}
|
||||
|
||||
# Community Packages
|
||||
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE: 'true'
|
||||
|
||||
# Timezone
|
||||
GENERIC_TIMEZONE: Europe/London
|
||||
|
|
@ -289,6 +313,35 @@ services:
|
|||
cpus: '1'
|
||||
memory: 1G
|
||||
|
||||
# Nginx для раздачи статических файлов
|
||||
n8n-static:
|
||||
image: nginx:alpine
|
||||
container_name: n8n-static
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- traefik-public
|
||||
volumes:
|
||||
- ./static:/usr/share/nginx/html:ro
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
|
||||
# Роутер для главной страницы
|
||||
- "traefik.http.routers.n8n-static-root.rule=Host(`n8n.ai-impress.com`) && (Path(`/`) || Path(`/index.html`))"
|
||||
- "traefik.http.routers.n8n-static-root.entrypoints=websecure"
|
||||
- "traefik.http.routers.n8n-static-root.tls.certresolver=cloudflare"
|
||||
- "traefik.http.routers.n8n-static-root.service=n8n-static-service"
|
||||
- "traefik.http.routers.n8n-static-root.priority=300"
|
||||
|
||||
# Роутер для статических файлов /assets/*, /static/*
|
||||
- "traefik.http.routers.n8n-static.rule=Host(`n8n.ai-impress.com`) && (PathPrefix(`/assets/`) || PathPrefix(`/static/`) || Path(`/favicon.ico`) || PathRegexp(`^/.*\\.wasm$`))"
|
||||
- "traefik.http.routers.n8n-static.entrypoints=websecure"
|
||||
- "traefik.http.routers.n8n-static.tls.certresolver=cloudflare"
|
||||
- "traefik.http.routers.n8n-static.service=n8n-static-service"
|
||||
- "traefik.http.routers.n8n-static.priority=250"
|
||||
|
||||
# Сервис
|
||||
- "traefik.http.services.n8n-static-service.loadbalancer.server.port=80"
|
||||
|
||||
volumes:
|
||||
n8n-data:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue