I am trying to make a WMS GetFeatureInfo request from an openlayers based application to GeoServer. But I am hitting the cross origin issue, as it know my origin is http:localhost.
Hopefully someone can help me here is my setup
I have geoserver installed on a windows server with IP x.x.x.x it is accessed via port 8080. I have my openlayers application installed locally in IIS 7.5 and I refer to it using
On the GeoServer server I configured the following
GeoServer is installed as part of GeoSuite v2.2, it uses Jetty web service. The GeoServer Proxy Extension is installed. ( http://geoserver.org/display/GEOS/GeoServer+Proxy+Extension ).
I have set up the rest proxy to use anonymous authentication. I had to do this in config.xml as there is a bug in this version of the GeoServer administration which stops the Authentication filter to be saved. I have also ensured that in the rest.properties fileit is configured to allow anonymous authentication. In the proxy configuration I have allowed localhost
In the openlayers application I set the Proxy Server setting as follows
OpenLayers.ProxyServer = "http://x.x.x.x:8080/geoserver/rest/proxy?url="
This is still not working, I still get the cross origin issue. I have not set the geoserver workspace Base Proxy Url as I am not sure if it is relevant. Do I need to set this? If so to what?
If anyone has solved this please let me know
All help is appreciated.
As mentioned above, you will need to create a proxy in IIS. How you do this can vary greatly, there are many ways to do it. Here's a prebuilt proxy for simplicity. It should be pretty easy to google more if you need them. They're a dime a dozen.
The great news is that the GeoServer 2.3 beta has JSONP support included for GetFeatureInfo requests. http://blog.geoserver.org/2013/01/29/geoserver-2-3-beta-released/ If you're okay with checking out the bleeding edge, this is the way to go. You'll no longer need the proxy.