ReRes icon indicating copy to clipboard operation
ReRes copied to clipboard

如何解决http请求跨域问题?Mac下file://也没反应

Open jkfaner opened this issue 3 years ago • 5 comments

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.

jkfaner avatar Jan 09 '22 10:01 jkfaner

已解决

jkfaner avatar Jan 09 '22 12:01 jkfaner

请问是怎么解决的

13632225945 avatar May 12 '22 04:05 13632225945

怎么解决的呢,我也遇到跨域问题了

suyunxue avatar Jun 06 '22 12:06 suyunxue

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.

同问怎么解决的

shuaiqileilei avatar Jun 01 '23 09:06 shuaiqileilei

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()

jkfaner avatar Jun 01 '23 10:06 jkfaner