GeoServer 2.15.0 version of the cross-domain problem solving

geoserver not open cross-domain default settings and the following steps:

1, the web.xml modify the configuration file, the configuration file follows the path

\webapps\geoserver\WEB-INF\web.xml

2, search for: cross-origin, part of the annotation explanatory note.

 <!-- Uncomment following filter to enable CORS -->
   <filter>
        <filter-name>cross-origin</filter-name>
        <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
       <init-param>
           <param-name>chainPreflight</param-name>
           <param-value>false</param-value>
       </init-param>
       <init-param>
           <param-name>allowedOrigins</param-name>
           <param-value>*</param-value>
       </init-param>
       <init-param>
           <param-name>allowedMethods</param-name>
           <param-value>GET,POST,PUT,DELETE,HEAD,OPTIONS</param-value>
       </init-param>
       <init-param>
           <param-name>allowedHeaders</param-name>
           <param-value>*</param-value>
       </init-param>
    </filter>
    
    
    <!-- Uncomment following filter to enable CORS  -->
    <filter-mapping>
        <filter-name>cross-origin</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

3, download jetty-servlets jar package, version 2.15.0 corresponding  Jetty-servlets-9.4.12.v20180830.jar , on

\geoserver\WEB-INF\lib

4, restart geoserver, if error, then download the corresponding  jetty-http  and  Jetty-util  JAR package, the lib directory, you can restart again

Guess you like

Origin www.cnblogs.com/yangzhengier/p/12072743.html