标签:app 接口 access web name any cti code map
tomcat7发布的webservice接口在被用户跨域访问的时候报错
(No ‘Access-Control-Allow-Origin‘ header is present on the requested resource. Origin ‘https://xcx1.winhui.net‘ is therefore not allowed access.)
解决办法
1、下载cors-filter-<version>.jar和java-property-utils-<version>.jar两个jar文件,并将其放在web服务器的classpath路径下,例如tomcat的lib。
cors-filter-2.4.jar java-property-utils-1.9.1.jar 包我这里就不提供了
2、在web.xml中添加CorsFilter过滤器
<filter> <filter-name>CorsFilter</filter-name> <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class> </filter>
<filter-mapping> <filter-name>CorsFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
3、然后重启tomcat就好了
备份一下,同时也给更多的水友多一条解决此问题的路径
标签:app 接口 access web name any cti code map
原文地址:https://www.cnblogs.com/Mys-ql/p/9431720.html