Attached is a screenshot of the error I’m getting when trying to run n8n locally using Docker Compose. This error doesn’t appear in Firefox. I’m running it on Ubuntu, and I’ve also installed a local Nginx instance. These are my configurations:
=> .env
Configuraciones del Host Externo (para Webhooks y Browser)
WEBHOOK_URL=https://n8n.local
N8N_BASE_URL=https://n8n.local
VUE_APP_URL_BASE_API=https://n8n.local
Configuraciones Internas (para Docker)
N8N_HOST=0.0.0.0
N8N_PORT=5678
Configuraciones de protocolo
N8N_PROTOCOL=https
N8N_PUSH_BACKEND=websocket
Configuración de proxy
N8N_TRUST_PROXY=true
N8N_SECURE_COOKIE=true
Opcional
TZ=America/Santiago
N8N_ENCRYPTION_KEY=tu_clave_secreta_aqui
=> docker-compose.yml
version: “3.8”
services:
n8n:
image: docker.n8n.io/n8nio/n8n:stable
restart: always
ports:
- “127.0.0.1:5678:5678”
env_file:
- .env
environment:
# Variables críticas adicionales
- N8N_TRUST_PROXY=true
- N8N_SECURE_COOKIE=true
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:
=> Nginx Configuration
1. Bloque para redireccionar HTTP (Puerto 80) a HTTPS
server {
listen 80;
server_name n8n.local;
return 301 https://$host$request_uri;
}
2. Bloque Principal HTTPS (Puerto 443)
server {
listen 443 ssl;
server_name n8n.local;
# Rutas a tus certificados auto-firmados
ssl_certificate /docker/n8n-local/ssl/n8n.local.crt;
ssl_certificate_key /docker/n8n-local/ssl/n8n.local.key;
# Configuración de seguridad SSL recomendada
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security “max-age=63072000; includeSubDomains; preload” always;
#
CONFIGURACIÓN CORREGIDA PARA WEBSOCKETS
location / {
proxy_pass http://localhost:5678;
# 🔄 CRÍTICO: Versión HTTP 1.1 para WebSockets
proxy_http_version 1.1;
# 🌐 WebSocket Headers - CONFIGURACIÓN COMPLETA
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
# 🏷️ Headers de identificación
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# ⏱️ Timeouts extendidos para WebSockets
proxy_read_timeout 86400;
proxy_send_timeout 86400;
proxy_connect_timeout 86400;
}
# 🎯 LOCACIÓN ESPECÍFICA PARA WEBHOOKS Y API (Opcional pero recomendado)
location /rest/ {
proxy_pass http://localhost:5678/rest/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400;
}
}
Variable para manejo de conexiones WebSocket (Agregar en http block)
Si no tienes acceso al http block principal, usa esta alternativa:
map $http_upgrade $connection_upgrade {
default upgrade;
‘’ close;
}
I would appreciate any help; I’ve been at this for several days now.
Describe the problem/error/question
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system:
