Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman配置geoserver跨域问题 #859

Open
klren0312 opened this issue Nov 4, 2024 · 0 comments
Open

podman配置geoserver跨域问题 #859

klren0312 opened this issue Nov 4, 2024 · 0 comments
Labels
Gis Linux Linux相关

Comments

@klren0312
Copy link
Owner

klren0312 commented Nov 4, 2024

1. 进入镜像终端

podman exec -it 镜像id /bin/bash

2. 安装vim

chmod 777 /tmp && apt-get update && apt install vim -y

3. 编辑tomcat配置文件

vim /usr/local/tomcat/webapps/geoserver/WEB-INF/web.xml

直接到文件中粘贴

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

4. 下载指定jetty版本

a. 访问对应geoserver版本的pom文件,查看jetty版本,我这里是2.25.4

https://github.com/geoserver/geoserver/blob/2.25.4/src/pom.xml

b. 下载指定jetty的jar包

https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-servlets/9.4.55.v20240627
https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-util/9.4.55.v20240627

右键获取链接,到镜像中wget下载即可
image
image

cd /usr/local/tomcat/webapps/geoserver/WEB-INF/lib
wget https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-servlets/9.4.55.v20240627/jetty-servlets-9.4.55.v20240627.jar
wget https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-util/9.4.55.v20240627/jetty-util-9.4.55.v20240627.jar

5. 重启镜像

podman restart 7f8b0dedd3d3

image

@klren0312 klren0312 added the Linux Linux相关 label Nov 4, 2024
@klren0312 klren0312 added the Gis label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gis Linux Linux相关
Projects
None yet
Development

No branches or pull requests

1 participant