-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access to fetch at 'http://127.0.0.1:5000/account/summary' from origin 'http://localhost:3000' 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. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. #333
Comments
I've encountered the same issue with The issue appears once after a while then vanishes after minutes/hours, then appears again without no changes, no deployment at my server. The issue cannot be bypassed by disabling security check in Chrome browser:
I will update this comment if I can figure it out. |
@terrynguyen255 did you ever figure this out? Edit: def add_cors_headers(response):
response.headers['Access-Control-Allow-Origin'] = FRONTEND_URL # Adjust as needed
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Allow-Headers'] = 'Content-Type, Authorization'
response.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, DELETE, OPTIONS'
return response
###
@app.after_request
def after_request(response):
return add_cors_headers(response)
# Handles preflight requests
@app.route('/', defaults={'path': ''}, methods=['OPTIONS'])
@app.route('/<path:path>', methods=['OPTIONS'])
def options_preflight(path):
return add_cors_headers(make_response()) |
@rajbirjohar Did it work?
|
@Dev-hugo-hash |
Sending request to server with question: Tell me about problem statement of Nerdy Buddy
handleAskQuestion @ Main.js:79 this is my error on network tab of inspection method.what i can do to resolve it? from flask import Flask, request, jsonify, make_response OPENAI_API_KEY = 'sk-proj-jjpMBTWs2swbZTrZuNznT3BlbkFJKxRipsRgBZiNH1JhkVZh' app = Flask(name) def create_chain():
Global variable to store the retrieval chainchain = None @app.route('/ask', methods=['POST'])
if name == 'main': |
Python: 3.9
Works sometimes with flask-cors 4.0.0
Works always with flask-cors 3.0.10
The text was updated successfully, but these errors were encountered: