Cloud Run: "Invalid origin!" on /rest/push — no fix available via env vars

Running n8n 2.6.3 (tested on 2.8.0+ too) on Google Cloud Run with PostgreSQL. The editor shows “Connection lost” due to the origin check in push/index.ts:143 rejecting requests because Cloud Run’s load balancer strips the Origin header.

Logs show:

Origin header does NOT match the expected origin. (Origin: "undefined" -> "N/A", Expected: "undefined" -> "undefined")
ResponseError: Invalid origin!

Env vars I’ve tried (none fix it):

  • N8N_PUSH_BACKEND=sse

  • N8N_PROXY_HOPS=1

  • N8N_EDITOR_BASE_URL=https://my-n8n-url.run.app

  • N8N_HOST=my-n8n-url.run.app

  • N8N_PROTOCOL=https

  • N8N_ENDPOINT_HEALTH=health (fixed the healthz conflict but not this)

  • N8N_CORS_ORIGIN=*

Cloud Run doesn’t allow custom header injection on its load balancer, so the nginx/Apache “set Origin header” workaround doesn’t apply. Can’t build a custom patched image because the official n8n Docker images currently have corrupted layers (invalid tar header).

Is there an env var to disable the origin check, or is a fix planned?

Hi @emp, Welcome to the n8n community :tada:
There’s no env var to disable this. The only real workaround is making sure the Origin header arrives correctly, either through a reverse proxy or an architecture adjustment. If Cloud Run is stripping the header and you can’t change that, then it’s an environment limitation, not an n8n issue.

1 Like

Thanks Tamy. I understand it’s an environment limitation which is why I’m requesting it as a feature. Cloud Run is one of the officially documented deployment targets in the n8n docs (https://docs.n8n.io/hosting/installation/server-setups/google-cloud-run/), and it’s a platform where users have no control over load balancer headers. An env var like N8N_SKIP_ORIGIN_CHECK=true would be a small change on n8n’s side that unblocks everyone on managed platforms. I’ve posted this as a feature request here: Feature Request: Env var to disable origin check on /rest/push (Cloud Run, Render, managed platforms)

1 Like

Hmm, now I understand. In that case, it’s necessary to post in the category feature-requests where the team can evaluate it.

1 Like