我正在编写一个Web应用程序,它从我已部署的其他服务请求数据。
我已将Apache httpd
配置为我的网络应用的代理。
...
Header always set Access-Control-Allow-Origin: http://localhost:8080
Header always set Access-Control-Allow-Methods: "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Allow-Credentials: true
...
使用jquery
发送请求:
$ajax('https://service.com/path',{
method: "POST",
xhrFields: {
withCredentials: true
}
})
我发送的请求中包含保存在Cookie中的令牌 我得到的回应是:
XMLHttpRequest cannot load https://service.com/path`. The 'Access-Control-Allow-Origin' header contains multiple values 'https://myapp.com, *', but only one is allowed.
我配置错误了什么?