vue呼叫Flask框架的介面跨域問題解決
阿新 • • 發佈:2021-01-20
from flask_cors import CORS app = Flask(__name__) # 跨域支援 def after_request(response): # JS前端跨域支援 response.headers['Cache-Control'] = 'no-cache' response.headers['Access-Control-Allow-Origin'] = '*' return response app.after_request(after_request) #******省略其他程式碼 if __name__ == "__main__": app.run(host="0.0.0.0", port=8999) # 解決跨域 CORS(app, supports_credentials=True)