Last active
May 6, 2022 04:05
-
-
Save essoen/91a1004c1857e68d0b49f953f6a06235 to your computer and use it in GitHub Desktop.
CORS * for GeoServer with Tomcat add following to `/var/lib/tomcat7/webapps/geoserver/WEB-INF/web.xml`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> | |
</filter> | |
<filter-mapping> | |
<filter-name>CorsFilter</filter-name> | |
<url-pattern>/*</url-pattern> | |
</filter-mapping> |
Plus if you use authentication add also:
<init-param>
<param-name>cors.allowed.headers</param-name>
<param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers, Authorization</param-value>
</init-param>
That‘s awesome!It saved my time.Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See here for reference.