a year ago
Project ID : b1d6fa08-43ff-4114-82f0-f836e0ee2651
Hi, I'm getting this error when trying to call from my frontend to Flask backend server hosted on Railway: Access to fetch at '[[http://c...pp](http://c...pp)/1980]([http://c...pp](http://c...pp)/1980)' from origin '[[http://localhost](http://localhost):3000]([http://localhost](http://localhost):3000)' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.
Here is my flask server looks like:
` ------------------ SETUP ------------------
load_dotenv()
app = Flask(name)
this will need to be reconfigured before taking the app to production
cors = CORS(app, resources={r"/*": {"origins": "[http://localhost](http://localhost)", "[[http://localhost](http://localhost):3000", "http://c…pp"]}})
…
------------------ START SERVER ------------------
if name == 'main':
app.run(debug=True, port=os.getenv("PORT", default=5000))
`
Do you have any suggestion?
Anyway, thank you for building amazing railway!
0 Replies
a year ago
are you using gunicorn?
I figured it out. On the front end, I actually called to [http://c...pp/1980](http://c...pp/1980)
though it should be [https://c...pp/1980](https://c...pp/1980)
This was a typo as my code was generated by Copilot
My railway server took the http request, redirected to make it https. That's why we got the Redirect is not allowed for a preflight request.
error
We can mark my problem as solved nơ
a year ago
it depends, are you using gunicorn for flask?
a year ago
no prob
a year ago
please do not close threads