2

I am using OL3, Geoserver. I made a website with Asp.net and add map with OL3. which is get data from geoserver with WFS. my website is located in C:\programfile\geoserver\www\mysite. Also config IIS that when client (with IP 192.168.0.100) clicl IP of server, it will show the website. (server IP is 192.168.0.1) the problem is that I receive this error.

XMLHttpRequest cannot load http://localhost:8000/geoserver/cite/ows?service=WFS&version=1.0.0&request=…e&typeName=cite:MyFeature&maxFeatures=50&outputFormat=application/json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.0.100' is therefore not allowed access. 

how can I config IIS and Geoserver that solve this problem?

2
  • How did you deploy GeoServer? Standalone, Tomcat?
    – ThomasG77
    Dec 5, 2014 at 18:00
  • @ThomasG77 I am using it Standalone, with jetty.
    – mike
    Dec 6, 2014 at 15:08

2 Answers 2

1

Googling, I've found an answer that can help you to set CORS if serving with Tomcat. CORS help you change Ajax "same origin policy" between domains.

Another alternative can be to use ARR (Application Request Routing) to use IIS as a proxy so everything seems to be coming from the same IP and you avoid same origin policy error you have at the moment; See this tutorial in this case.

Maybe, there are other solutions but I don't come from IIS world (using mainly Linux now)

0

I tried a lot to config IIS ARR reverse proxy but unfortunately it was not useful for me. Also using CORS is not good idea because some of the browsers don't support it. So I became to write a proxy in asp.net by Generic handler. create proxy.ASHX file. then pass the url to this file. like:

url = "proxy.ashx?url=http://localhost:8080/geoserver/wfs/...."

then use WebRequest to send my request and get the response by HttpWebResponse and send it back to my website.

Your Answer

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

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