Describe the problem/error/question
The main problem is that the origin header seems to be duplicating without reason. I have my n8n instance runing through a docker container in my linux vps. I’m using the next docker compose:
.env
# DOMAIN_NAME and SUBDOMAIN together determine where n8n will be reachable from
# The top level domain to serve from
DOMAIN_NAME=example.com
# The subdomain to serve from
SUBDOMAIN=n8n
# The above example serve n8n at: https://n8n.example.com
# Optional timezone to set which gets used by Cron and other scheduling nodes
# New York is the default value if not set
GENERIC_TIMEZONE=Europe/Madrid
# The email address to use for the TLS/SSL certificate creation
[email protected] # is this mandatory?
services:
n8n:
image: n8nio/n8n
restart: always
ports:
- "127.0.0.1:5678:5678"
environment:
- N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
- N8N_EXPRESS_TRUST_PROXY=true
- N8N_PROXY_HOPS=1
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
- N8N_RUNNERS_ENABLED=true
- N8N_RESTRICT_FILE_ACCESS=true
- N8N_EDITOR_BASE_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
- N8N_CORS_ALLOW_ORIGIN=https://${SUBDOMAIN}.${DOMAIN_NAME}/
volumes:
- n8n_data:/home/node/.n8n
- ./local-files:/files
volumes:
n8n_data:
Also I’m using apache installed on the host, not container, with this file
<VirtualHost *:443>
ServerName ${SUBDOMAIN}.${DOMAIN_NAME}
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/${SUBDOMAIN}.${DOMAIN_NAME}/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/${SUBDOMAIN}.${DOMAIN_NAME}/privkey.pem
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5678/
ProxyPassReverse / http://127.0.0.1:5678/
ProxyPass /rest/push ws://127.0.0.1:5678/rest/push
ProxyPassReverse /rest/push ws://127.0.0.1:5678/rest/push
# Solo si estás 100% seguro de que Apache es el primer proxy
RequestHeader set X-Forwarded-Ssl "on"
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set Origin https://${SUBDOMAIN}.${DOMAIN_NAME}
RequestHeader set X-Forwarded-Port "443"
RequestHeader set X-Forwarded-Host "${SUBDOMAIN}.${DOMAIN_NAME}"
RequestHeader set X-Forwarded-For "%{REMOTE_ADDR}"
ErrorLog ....
CustomLog ...
</VirtualHost>
What is the error message (if any)?
Origin header does NOT match the expected origin. (Origin: “${SUBDOMAIN}.${DOMAIN_NAME}”, Expected: “${SUBDOMAIN}.${DOMAIN_NAME}, ${SUBDOMAIN}.${DOMAIN_NAME}”)
ResponseError: Invalid origin!
at Push.handleRequest (/usr/local/lib/node_modules/n8n/src/push/index.ts:143:10)
at /usr/local/lib/node_modules/n8n/src/push/index.ts:100:10
at Layer.handleRequest (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/router/lib/layer.js:152:17)
at trimPrefix (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/router/index.js:342:13)
at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/router/index.js:297:9
at processParams (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/router/index.js:582:12)
at next (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/router/index.js:291:5)
at /usr/local/lib/node_modules/n8n/src/auth/auth.service.ts:106:18
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): Docker
- Operating system: Ubuntu 22.04.5 LTS