Skip to content
Sign upLog in
← Back to Community

CORS blocking request when using custom domain.

Profile icon
xfinnbar
Access to XMLHttpRequest at 'https://textworld.xfinnbar.repl.co/api/create_page' from origin 'https://textworld.tk' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

The error only appears when using my custom domain, https://textworld.tk, instead of the repl.co one

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
Profile icon
xfinnbar
Comments
hotnewtop
Profile icon
Coder100

add this to ur code like:

from flask import Flask from flask_cors import CORS app = Flask(__name__) CORS(app) @app.route("/") def helloWorld(): ... ...

so easy

Profile icon
xxpertHacker

Just send COORS HTTP headers.