6

To enable CORS filter I added the following in web.xml file in webapps/Geoserver/WEB-INF

<filter>
 <filter-name>cross-origin</filter-name>
 <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>

...

<filter-mapping>
    <filter-name>cross-origin</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

After adding above, I restarted GeoServer. Now, when I access GeoServer, I get following error:

HTTP ERROR: 503

Problem accessing /geoserver/. Reason:

Service Unavailable
2
  • how are you installing & running geoserver? which version of GeoServer are you using?
    – Ian Turton
    Dec 5, 2016 at 11:46
  • I have installed Geoserver v2.9.1 window installation package (with manual startup).
    – Senthil S
    Dec 5, 2016 at 11:48

2 Answers 2

6

We had the same issue, after enabling CORS by removing the comments in web.xml original file supplied with GeoServer, GeoServer was no longer starting properly in any configuration (we tried using Mac OS X installer, with the platform independent binary and using Apache/Tomcat).

Finally, we managed to get the configuration to work using Apache/Tomcat but not using the default filter org.eclipse.jetty.servlets.CrossOriginFilter specified in web.xml supplied file but the Tomcat org.apache.catalina.filters.CorsFilter filter, as per https://enable-cors.org/server_tomcat.html (see also jgrocha answer at https://stackoverflow.com/questions/22363192/cors-tomcat-geoserver):

<filter>
  <filter-name>CorsFilter</filter-name>
  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>CorsFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>
4

Have you check jar file in :

WEB-INF/lib/jetty-servlets*.jar

(not 'jetty-servlet'!)

If you don't have You can download in here.

and

You can check your Jetty version in :

[GEOSERVER_HOME]/lib

1
  • hey, is it going to work in tomcat too ? I installed geoserver on tomcat Jan 22, 2020 at 20:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.