N8n on cyberpanel : new issue

Describe the problem/error/question

I managed to run n8n on cyberpanel following this brilliant guide : Install N8n on Docker in cyberpanel

I upgraded n8n to 1.106.3 and cyberpanel to 2.4.3 and get a new error

What is the error message (if any)?

Origin header is missing
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: 1.106.3
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: cyberpanel

Hello, are you using queue mode or just regular mode? From your logs, this looks like an error that happened last month on one of my servers using CyberPanel. I worked around it by using Cloudflare rules like this

thanks for looking into this! I’m not using cloudflare but the settings described in the link I quoted. I don’t know if there is a place where I can force the same thing (in the .htaccess or the /usr/local/lsws/conf/httpd_config.conf files)?

Are you using websocket or sse on this env N8N_PUSH_BACKEND?

sse (always have: if I don’t I get another kind of error)

I’ve tried configuring it via .htaccess like this before, but it still didn’t fix the error. That’s why I’m using a Cloudflare solution, you can try this if you want:

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteRule ^(.*)$ - [E=HTTP_ORIGIN:https://%{HTTP_HOST}]
RewriteRule ^(.*)$ - [E=HTTP_X_FORWARDED_PROTO:https]
RewriteRule ^(.*)$ - [E=HTTP_X_REAL_IP:%{REMOTE_ADDR}]

RewriteRule ^(.*)$ http://n8n/$1 [P,L]

If that still doesn’t work, try accessing openlitespeed > yourcyberpanel.com:7080 and select the virtual host for the n8n domain. Then, choose the context tab and add a static entry there to manually configure the headers.

thank you, I will try. you don’t have by chance a step by step guide to use cloudflare instead of the configs on CP?

You need to point your parent domain from your domain vendor to Cloudflare first. This video might help: Pointing Domain To Cloudflare then you can auto sync DNS from cyberpanel menu

In my opinion, it’s better to use AApanel if you are not using the user management features in CyberPanel. If you are doing more app deployments using Docker, you could try Portainer, Coolify, or Dokploy.