ReRes
ReRes copied to clipboard
如何解决http请求跨域问题?Mac下file://也没反应
Access to script at 'http://localhost:5000/xxxxx' (redirected from 'https://www.xxxx.com/xxx/xx/xx.') from origin 'https://www.xxxx.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
已解决
请问是怎么解决的
怎么解决的呢,我也遇到跨域问题了
Access to script at 'http://localhost:5000/xxxxx' (redirected from 'https://www.xxxx.com/xxx/xx/xx.') from origin 'https://www.xxxx.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
同问怎么解决的
Access to script at 'http://localhost:5000/xxxxx' (redirected from 'https://www.xxxx.com/xxx/xx/xx.') from origin 'https://www.xxxx.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
同问怎么解决的
使用python的Flask搭建web服务时:
import webbrowser
from flask import Flask
from flask_cors import CORS
app = Flask(__name__)
CORS(app) # 关键
@app.route("/test")
def test():
return app.send_static_file("test.js")
if __name__ == "__main__":
webbrowser.open("http://127.0.0.1:5000")
app.run()