I am struggling with how to access geoserver web services in my openlayers application. I setup a test machine that hosted both geoserver and the openlayers app as well as a postgres database to publish data from. I was able to just add the services as layers to my application by specifying crossorigin: anonymous. Now I need to move to a different environment where geoserver resides on a separate server, and the postgres database also resides on its own server, and these two servers are not public facing, but are on the same network as a public facing server which will host the openlayers app. When I try to access the application internally I get a CORS error and the services won't load; externally the server name included in the service url just can't be resolved. The web server is running IIS on port 80, and geoserver is running on port 8085 on its own backend machine. What do I need to do be able to see my services in my web application in this 3 tier environment?


I tested the solution below, and it works (whether I set the proxy based url or not) when i am logged into a virtual machine on our network. However when I try to login to the application via a browser on a machine outside of the network, which I can do by supplying my domain credentials, the services still don't load. I get this error for each of my service URLs: Failed to load resource:net::ERR_NAME_NOT_RESOLVED.

1 Answer 1


You need to enable CORS in the servlet engine (Jetty, Tomcat?) that is running GeoServer. You will also need to set the proxy url on the global settings page to reflect the external server address (IIS) otherwise the URLs in the GetCapabilities responses will be wrong.

  • Thanks for your answer on this. These are all windows servers on the same domain so does this also hold true for that?
    – kflaw
    Commented May 31, 2018 at 12:42
  • yes, why wouldn't it
    – Ian Turton
    Commented May 31, 2018 at 12:53
  • I was also thinking this might be what I needed to do based on my prior research and presented this idea to our IT person who setup and admins the environment and he said it was not necessary as the machines are in the same domain. But I’m getting the CORS error when I try to access within the domain! Confusing.
    – kflaw
    Commented May 31, 2018 at 13:11
  • 1
    CORS depends on machine and port number so it is relevant here
    – Ian Turton
    Commented May 31, 2018 at 13:15
  • A correction to my description above, there is technically no public facing server. But there is a web server in the domain running IIS which hosts the openlayers application. Users who are able to authenticate can load this application in a browser, they are essentially logging into the domain via the browser when the application is pulled up. Not really sure if the same solution applies.
    – kflaw
    Commented May 31, 2018 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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