Hello everyone! I’m new to n8n as well as programming and having trouble with CORS configuration for webhooks. I have browsed all related topics about CORS issues but cannot find the solution for my case. Maybe I searched for solutions in the wrong way, or may be not smart enough to understand those approaches. I also tried to let cursor with claude 4 sonnect ai helping figure out the problem and solve it, but still with no good luck. It would be very helpful if someone could give me a helping hand, thanks in advance.
======
I’m building a frontend application (at localhost:5173) that needs to communicate with n8n workflows (at localhost:5678), but I’m experiencing inconsistent CORS behavior.
The issue: My POST webhook works perfectly with cross-origin requests, but GET webhook requests are being blocked by CORS policy. I’m wondering if I’m missing something in my configuration or if there’s a recommended approach for handling CORS with n8n webhooks.
I have two workflows:
[Reason of two workflows instead of one: Because within my POST workflow, it contains a LLM model that takes long time to process (causes timeout error on the frontend page if I choose “when last node finishes” for my webhook node).]
POST webhook works fine:
Problematic GET Webhook (result retrieval):
POST webhook response (works fine):
HTTP/1.1 200 OK
access-control-allow-origin: http://localhost:5173
Content-Type: application/json
{"jobId":"job_123","status":"processing_initiated"}
Console error shown in frontend page for GET webhook:
localhost/:1 Access to XMLHttpRequest at 'http://localhost:5678/webhook-test/result?job_id=job_1749101990906if8lv' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Remark: Not sure if this info would be useful: I have also tried to set “access-control-allow-origin:” with “*” for “webhook” nodes and “respond to webhook” nodes in both workflows as well, but this approach doesn’t help.
Information on your n8n setup
- n8n version: 1.95.3
- Database: SQLite
- n8n EXECUTIONS_PROCESS setting: own
- Running n8n via: Docker
- Operating system: macOS
Additional context:
I’ve tried adding explicit CORS headers in the response nodes and using the native allowedOrigins
option, but the behavior seems inconsistent between GET and POST requests. Any guidance on the proper way to configure CORS for n8n webhooks would be greatly appreciated!
Thank you in advance for any help!