Ivanyan π΄
Explore posts from serversRRailway
β’Created by Ivanyan π΄ on 5/19/2024 in #βο½help
CORS issue calling to railway from other domain
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/1980' from origin '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: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!10 replies