geoserver 跨域问题

此解决方案针对在tomcat下通过geoserver.war包部署的方法

(该流程从别人处复制,仅为自己记忆)
1、下载cors-filter-2.6.jar、java-property-utils-1.13.jar两个文件,放到.\geoserver\WEB-INF\lib目录下

2、将以下配置放到geoserver\WEB-INF目录下的web.xml文件

<filter>         
    <filter-name>CORS</filter-name>  
    <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>  
    <init-param>  
     <param-name>cors.allowOrigin</param-name>  
        <param-value>*</param-value>  
    </init-param>  
    <init-param>  
     <param-name>cors.supportedMethods</param-name>  
        <param-value>GET, POST, HEAD, PUT, DELETE</param-value>  
    </init-param>  
    <init-param>  
     <param-name>cors.supportedHeaders</param-name>  
        <param-value>Accept, Origin, X-Requested-With, Content-Type, Last-Modified</param-value>  
    </init-param>  
    <init-param>  
        <param-name>cors.exposedHeaders</param-name>  
        <param-value>Set-Cookie</param-value>  
    </init-param>  
    <init-param>  
        <param-name>cors.supportsCredentials</param-name>  
        <param-value>true</param-value>  
    </init-param>  
</filter>  
  
<filter-mapping>  
    <filter-name>CORS</filter-name>  
    <url-pattern>/*</url-pattern>  
</filter-mapping>

 

posted @ 2019-01-08 18:29  留下来  阅读(678)  评论(0编辑  收藏  举报