Geoserver installation and cross-domain problem solutions

1. Software download

Enter the geoserver official website to download, official website link: http://geoserver.org/
insert image description here

2. Software startup

Open the bin directory, double-click startup.bat to start geoserver.
insert image description here
After startup, you can see that the default port is 8080.
Browser access: http://localhost:8080/geoserver/web/, enter the home page of geoserver.
Login to geoserver service
default account password
username:admin
password:geoserver

3. Solve cross-domain problems

Reporting this error means that there is a cross-domain problem
insert image description here

solution

1. Enter the geoserver directory, punch in the lib folder

insert image description here

2. Copy jetty-servlets-9.4.18.v20190429.jar and jetty-util-9.4.18.v20190429.jar to the geoserver2.18\webapps\geoserver\WEB-INF\lib folderinsert image description here
3. Open web.xml under WEB-INF and configure as follows

When using jetty as Server, uncomment the following content (about line 170)

<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>

At the same time uncomment the paragraph (about 218 lines)

<filter-mapping>
<filter-name>cross-origin</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

Guess you like

Origin blog.csdn.net/YG_zhh/article/details/128670760