Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to add an Access-Control-Allow-Origin:* to the response from GeoServer because I need to download images from another domain. Instand of build a proxy, I prefer to use Cross Origin Filter of Jetty(GeoServer's Web Server) to achieve this. However, I don't know how to set it up in GeoServer.

  1. My GeoServer's version is 2.1.3 so the Jetty's version is 6, which does not include the jetty-servlets.jar.
  2. I downloaded the jetty-servlets-8.1.5.v20120716.jar from here and renamed it to jetty-servlets.jar, then put it into /Applications/
  3. Then I add the following codes to the web.xml file at /Applications/


At last, I restarted GeoServer but the page at http://localhost:8080/geoserver/web showed me an error 404:

Powered by jetty://

Is there anyone who can help me? Thank you!

share|improve this question
I just had your code <filter> <filter-name>cross-origin</filter-name> <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class> </filter> <filter-mapping> <filter-name>cross-origin</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> and i have the same mitake : ERROR 503 ! – ROCHEDY Feb 11 '13 at 14:11
look at the jetty log. I think you sould also add jetty-util lib – user58939 Sep 9 '15 at 8:36

It's very unlikely that you can add random jars to your jetty install and expect it to work - which seems to be case here.

The easiest solution (if you really can't be bothered to add a proxy script) is to download the latest version of jetty and add the GeoServer war file to it and then modify the web.xml file.

share|improve this answer
I downloaded jetty-distribution-8.1.5.v20120716.tar.gz and added the GeoServer 2.1.4 war to the webapps folder. After I started Jetty, other apps like "test" and "spdy" could run very well but the "geoserver" could not run, which showed me an Error 503. Does the GeoServer needs other settings? I'm a newbie of GIS and I just feel that use proxy is not an elegant way, so could you provide more detail steps? Thank you very much! – houhr Aug 30 '12 at 9:53
you can use tomcat +apache – neogeomat Apr 12 '13 at 16:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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