具有正确标题的烧瓶应用程序的CORS问题

时间:2019-05-17 20:46:55

标签: python reactjs flask cors

我有一个带有socketIO插件的Flask服务器,这给我一个反应前端提供了CORS问题。

这是我的JS终端中记录的错误

Access to XMLHttpRequest at 'http://localhost:5000/socket.io/?EIO=3&transport=polling&t=Mh7YS7W' from origin 'http://localhost:3000' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

我看看请求的标题

andf从服务器端放置正确的标头以允许CORS

Here are my headers

从服务器终端和我的javascript终端返回的请求均带有200状态代码。

这是我在服务器端的cors配置

app.config['DEFAULT_PARSERS'] = [
'flask.ext.api.parsers.JSONParser',
'flask.ext.api.parsers.URLEncodedParser',
'flask.ext.api.parsers.FormParser',
'flask.ext.api.parsers.MultiPartParser'
]
...
cors = CORS(app, resources={r"/*": {"origins": "*"}})

0 个答案:

没有答案