Tomcat8.5.33版本实现Ajax跨域

1、下载cors-filter-2.5.jar,java-property-utils-1.9.1.jar

2、在\conf\web.xml增加


CorsFilter
org.apache.catalina.filters.CorsFilter

cors.allowed.origins
*


cors.allowed.methods
GET,POST,HEAD,OPTIONS,PUT


cors.allowed.headers
*


cors.exposed.headers
Access-Control-Allow-Origin,Access-Control-Allow-Credentials


cors.support.credentials
false

3、亲测可用

你可能感兴趣的:(tomcat)