This question already has an answer here:
<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.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> <init-param> <param-name>cors.exposed.headers</param-name> <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value> </init-param> </filter> <filter-mapping> <filter-name>CorsFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
I have also added URL rewrite within IIS which links port 80 to Tomcat/GeoServer on port 8080. When opening the map in browser on another machine everything but the vector tiles from GeoServer displays. This is the error message I get:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8080/geoserver/gwc/service/tms/1.0.0/webmap:target_status@EPSG%3A900913@pbf/6/53/25.pbf. (Reason: CORS request did not succeed).
I have also noticed that X-Frame is set to SAME ORIGIN for the vector tiles.
Is there anything else missing or wrong with my setup? I would like to be able to open the web map through the URL and for the layers to be displaying? Is the CORS issue coming from IIS or Tomcat?
Edit: Just wanted to clarify that GeoServer itself is working as I can access it from another machine, through the URL. It is just the vector tiles which are generating the CORS error when viewing the map.