I built an express api to serve custom templates. It works in local dev as I am able to provide devServer proxy in vue.config.js to overcome CORS limitations.
For production I am using Docker Compose. However devServer is not valid in production and I am hoping if some one could teach me to setup a proxy from Vue to my templates API that overcomes CORS.
I have both n8n and templates-api as services in the same docker-compose.yml.
Is this a problem you are seeing in n8n or an issue with the templates service you have made?
The custom templates api is reachable from within EC2 terminal using CURL get http:localhost:3000/health. But from n8n which is a service within the same compose network the same returns CORS error : corsDisabledScheme
So is this a service you have made? I am just trying to work out if this is an issue with n8n itself or something outside of n8n so I can try to help.
Yes a Node js Express API that serves custom templates. I have enabled CORS in express. This API is a service along with n8n in Docker Compose sharing the same compose network.
I have set the env var N8N_TEMPLATES_ENABLED=custom-templates-api:3000
When you say CORS is enabled what have you done there? It sounds like you may need more of a NodeJS support forum but I will see what I can work out with you.
I have allowed CORS in my express API. So this API-Server will not block requests originating from a different domain.
That is odd, If you are getting a cors error back it sounds like maybe it is blocking the requests still. Does the error in the browser show any more info?
Hey It is resolved now. The problem was with the templates host URI variable. I misunderstood it to be an internal call from n8n backend to my templatesAPI. Instead it is the browser making the call and thus had to change URI to one that is accessible via internet.
@Jon Sorry for the confusion and thank you very much…