CORS issue in Railway Deployment

Describe the problem/error/question

I have configured a webhook to be triggered when a POST request is made to the endpoint. The request is made from a different domain. Lets say I have n8n in auto.n8n.com and the domain making the request is store.com

What is the error message (if any)?

Access to fetch at ‘https://auto.n8n.com/webhook/number/back-stock-form’ from origin ‘https://storedomain.com’ has been blocked by CORS policy: Request header field authorization is not allowed by Access-Control-Allow-Headers in preflight response.

Please share your workflow

Its a long workflow that communicates with Mailchimp API but all the steps are working. What is not working is to fetch the webhook.

My webhook includes the following headers:

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 0.234.0
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker deployed in Railway.
  • Operating system:

Hi @computin_dev, welcome to the community!

n8n does not have support for all relevant methods unfortunately. The webhook node would not support OPTIONS requests for example. I really wish it was different but that’s unfortunately the current status.

So for the time being you would need to implement this on a reverse proxy level, similar to what @roemhildtg described over here for example.

Alternatively, you could consider using a designated webhook router such as Hookdeck or Convoy to receive the webhooks and forward them to n8n. These are likely better equipped to handle browser requests, check for example this post on the Cloudron forums discussing a similar problem.

Thanks a lot for you warm welcome and reply, @MutedJam. I ended up reading the same questions and suggestions you mentioned on my quest for a solution. Will see if one of those services work or either change from Railway to another service.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.