When I make a “curl -I -X OPTIONS https://n8n.mydomain.com/”, the headers shows correctly, but when I make the same request to a webhook url (https://n8n.mydomain.com/webhook/test), I don’t get the CORS header, so I can’t make HTTP request to workflows.
I’ve added header /webhook/* and it is being shown now, but I’m having this error (I’ve changed the urls):
Access to fetch at 'https://n8n.mywebsite.com/webhook/test' from origin 'https://otherdomain.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values 'https://otherdomain.com/, https://otherdomain.com/', but only one is allowed. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Do you have any clue what could be happening? Maybe n8n is changing the caddy configuration?
n8n won’t be changing Caddy we don’t have that ability, Have you tried removing the Access-Control-Allow-Origin header from Caddy to see if that works?
I wasn’t able to make it work. I also asked the Caddy community. I changed the request from content-type to plain text and transform it to JSON back again in n8n. This works as is not blocked by CORS.