加载Geoserver数据出现跨域问题解决:
修改路径 C:\Program Files (x86)\GeoServer 2.15.0\webapps\geoserver\WEB-INF 下的 web.xml文件(路径具体还要看Geoserver的安装位置)
<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><filter-mapping><filter-name>cross-origin</filter-name><url-pattern>/*</url-pattern></filter-mapping>
上述代码默认是被屏蔽了的,手动取消屏蔽,保存(管理员身份),重启Geoserver即可。
QQ群(GIS开发交流、数据共享、软件使用):993836992