geoserver跨域问题解决方案

1.由于geoserver为war形式,需要解决tomcat跨域问题,geoserver版本为2.9.1

2.下载war包,
下载cors-filter-1.7.jar,Java-property-utils-1.9.jar这两个库文件,放到lib目录下
http://download.csdn.net/detail/jinxiumeihappy/9886977

3.修改配置文件
修改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>

跨域问题解决

转载自:https://blog.csdn.net/jinxiumeihappy/article/details/74170832

You may also like...