Apache httpd为CORS返回多个值

时间:2016-11-09 09:33:43

标签: apache cors httpd.conf

我正在编写一个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.

我配置错误了什么?

0 个答案:

没有答案