我在Angular2组件中使用请求连接Neo4j时遇到了CORS问题:
Response to preflight request doesn't pass access control check. A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://localhost:8080' is therefore not allowed access. The credentials mode of an XMLHttpRequest is controlled by the withCredentials attribute
我该如何在请求(TypeScript)中设置
withCredentials:false
?我假设这将解决问题。但是请求ts文件没有在其CoreOptions
对象中列出withCredentials
。Neo4j-Typescript包的TypeScript定义也没有包含此功能。
withCredentials
设置为false,您必须将"Access-Control-Allow-Credentials":"false"
和noCredentials: true
添加到 devServer 配置选项中。但是,也请参阅 issue #356 获取帮助。 - Edan