I’m building an n8n chatbot workflow where I need to call our internal energy APIs that require two auth values from the browser request:
the session cookie (access_token) and
x-csrf-token.
These values are present in the browser request headers when the user is logged into our main app. I need to capture them in my frontend and forward them to n8n, so that n8n can use those same headers in its HTTP Request nodes to call the downstream protected API.
But when I send the request:
axios.post(“http://localhost:5678/webhook/energy-chat-bot”, body, {
headers: { “Content-Type”: “application/json” },
withCredentials: true
});
the browser throws a CORS error, and n8n does not receive any cookies.
I’m looking for guidance on:
-
How to properly allow cookies + custom headers (CSRF token) in n8n webhook CORS settings
-
How to safely capture these values in the webhook and forward them into the HTTP Request node
-
Whether n8n webhooks are expected to accept cookies in cross-origin POSTs with
withCredentials
Essentially: Frontend → n8n Webhook → Internal API, with cookies + CSRF token preserved, but CORS currently blocks it.
