Cors error calling api from static page

Hi Guys,
i am calling an api endpoint on render from another URL on render via ajax.
When I got a CORS error, I tried

from flask_cors import CORS

app = Flask(__name__)

on my backend. But it didnt help
Any Advise ?

1 Like

Hi there,

Your backend would need to be configured to send the CORS headers you require. Just importing the library likely wouldn’t be enough, e.g. the Access-Control-Allow-Origin header would need to be set with your frontend domain, etc.

You’d need to refer to the Flask CORS library documentation to see how to set the correct values. You can test to see if the headers are set correctly by making a curl request like curl -I https://my-backend-service-endpoint

Hope that helps


1 Like

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