有CORS报头的交叉源请求被阻塞

[英]Cross-Origin Request Blocked with CORS headers present


on the server side I have the following filter in apache which allow all methods and all origins by defaults

在服务器端,我在apache中有以下过滤器,默认情况下允许所有方法和所有起源

<filter>
  <filter-name>CorsFilter</filter-name>
  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>CorsFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

Using angular $http One post is working, but another fail failed. The request that fails talks to another app on the same apache.

使用角$http One post正在工作,但另一个失败失败。失败的请求与同一apache上的另一个应用程序对话。

Cross-Origin Request Blocked: The Same Origin Policy disallows 
reading the remote resource at http://localhost:.. 
(Reason: CORS header 'Access-Control-Allow-Origin' 
does not match 'http://localhost:8100, http://localhost:8100').

But the response header does contain the ACAO

但是响应头确实包含ACAO

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
access-control-allow-credentials: true, true
access-control-allow-origin: http://localhost:8100, http://localhost:8100
Vary: Origin
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 22 Oct 2015 04:35:29 GMT

Where did the ' http://localhost:8100, http://localhost:8100' come from ? Do you think it is angular $http or Apache problem ?

“http://localhost:8100、http://localhost:8100”来自何处?你认为这是角$http还是Apache问题?

1 个解决方案

#1


2  

Access-Control-Allow-Origin accepts either '*' or a single origin for its value. You can't put a comma-separated list there.

访问控制允许来源接受“*”或单一来源的值。不能在那里放一个逗号分隔的列表。

The browser is matching the origin (http://localhost:8100 against http://localhost:8100, http://localhost:8100 and not getting a match.

浏览器正在匹配源(http://localhost:8100与http://localhost:8100、http://localhost:8100,并且没有得到匹配。

You have a similar problem on the line before. It looks like you are running the code to insert your CORS headers twice.

你之前也有类似的问题。看起来您正在运行代码以插入CORS头部两次。

智能推荐

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2015/10/22/aea03d385ecdc5d91ee73bd3b74b735f.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告