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

Implement CORS on tomcat #60

Closed
jorgejesus opened this issue Feb 28, 2019 · 3 comments
Closed

Implement CORS on tomcat #60

jorgejesus opened this issue Feb 28, 2019 · 3 comments

Comments

@jorgejesus
Copy link

The image doesn't implement CORS and this is required for webgis developments

Tryied to implement CORS on
/usr/local/tomcat/conf/web.xml

By adding the following configuration:

<filter>
  <filter-name>CorsFilter</filter-name>
  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
  <init-param>
    <param-name>cors.allowed.origins</param-name>
    <param-value>*</param-value>
  </init-param>
  <init-param>
    <param-name>cors.allowed.methods</param-name>
    <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
  </init-param>

  <init-param>
    <param-name>cors.exposed.headers</param-name>
    <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
  </init-param>
  <init-param>
    <param-name>cors.preflight.maxage</param-name>
    <param-value>10</param-value>
  </init-param>
</filter>
<filter-mapping>
  <filter-name>CorsFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

But still there was problems with CORS not being suported on Chrome (Linux) v71

Some explanation has been found here:
https://stackoverflow.com/a/24390640/1140558
https://stackoverflow.com/a/39733875/1140558

Seems that setting Origin on a request it works and gets the proper headers back:
curl -I -H 'Origin: http://www.example.com' http://localhost:8080/geoserver

@NyakudyaA
Copy link
Collaborator

@jorgejesus How did you implement the CORS?. Did you have a problem with implementing this?
I think the image provides you with an option to include the CORS. The structure of the web.xml comes from tomcat and how you test the request seems like a user issue more than the image does not do this.

@jmjurado23
Copy link

Hello, I have the same issue with CORS in geoserver tomcat deploy. I have not managed to enable cors to use platform for DEV purposes.

@NyakudyaA
Copy link
Collaborator

Hi @jmjurado23 can you pull the image 2.15.2 I built it with CORS using the file system overlays
format

cc @jorgejesus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants