There have been several questions very similar to this asked already (including ones not involving GeoServer), but their solutions have not solved my problem. I am trying to use GetFeatureInfo on my GeoServer WMS layers, which are hosted on a different domain than the website on which they will be used, and have since learned that I need a proxy to accomplish this.
I have followed the instructions on how to set this up in Tomcat 6 (except for renaming .jar file as it's unnecessary in v6), added www.greengeography.org and the IP of my local network to the proxy.cgi file, then changed the top line to #!/usr/bin python as that's where it's at in Amazon's EC2 Linux (and also tried a slash instead of space as I've seen both ways).
I am confused on URL mapping, servlet mapping, and where to create a CGI directory, so I tried it in just about every location within the /tomcat6/webapps, including the main GeoServer directory. The only place I am able to access the CGI file in a browser is at the root. Why can I not make this happen in the GeoServer directory, which is where I think it needs to be? I did not see instructions about changing the URL mapping, so I'm not positive it's the problem.
As suggested in several other questions posted on this site, I attempted to install the GeoServer Proxy Extension instead of configuring this stuff manually, but every time I tried to access it from the GS admin page, I got Java errors (no matter which version of the extension I tried), so I gave up and went back to manual.
If it helps, here is some of my JavaScript, and I have tried just about every URL variation I could think of:
OpenLayers.ProxyHost="http://50.112.123.161:8080/geoserver/cgi-bin/proxy.cgi?url=";
And the GeoExt part:
var featureInfo = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://50.112.123.161:8080/geoserver/gwc/service/wms',
queryVisible: true,
exceptions: "application/vnd.ogc.se_xml",
layerUrls: ["http://50.112.123.161:8080/geoserver/OR_wild_wkspc/wms","http://50.112.123.161:8080/geoserver/gwc/service/wms"],
eventListeners: {
getfeatureinfo: function(e) {
new GeoExt.Popup({
title: "Feature Info",
width: 400,
height: 300,
autoScroll: true,
queryVisible: true,
map: map,
feature_count: 50,
lonlat: mapPanel.map.getLonLatFromPixel(e.xy),
html: e.text
}).show();
}
}
});
mapPanel.map.addControl(featureInfo);
featureInfo.activate();
I have also been getting these errors in my GeoServer logs:
2012-02-13 23:52:22,922 ERROR [config.XMLConfiguration] - Configuration file cannot be read or does not exist!
2012-02-13 23:52:22,923 ERROR [layer.TileLayerDispatcher] - Configuration /usr/share/tomcat6/webapps/geoserver/../resources contained no layers.
2012-02-13 23:52:22,924 ERROR [layer.TileLayerDispatcher] - Error reading service information from /usr/share/tomcat6/webapps/geoserver/../resources: Error parsing file /usr/share/tomcat6/webapps/geoserver/../resources/geowebcache.xml
I also get ones when a file cannot be found. This one happens to be an html file since it was just a test to see if I could figure out the paths, but the rest of them are for proxy.cgi:
2012-02-13 19:50:22,785 WARN [servlet.PageNotFound] - No mapping found for HTTP request with URI [/geoserver/OR_wild_wkspc/test.html] in DispatcherServlet with name 'dispatcher'
Last but not least, I also tried more paths to point to the .cgi file, as suggested here. But no matter what, I get this error in Chrome Developer:
XMLHttpRequest cannot load http://50.112.123.161:8080/proxy.cgi?url=http://50.112.123.161:8080http%3A%2F%2F50.112.123.161%3A8080%2Fgeoserver%2FOR_wild_wkspc%2Fwms%3FSERVICE%3DWMS%26VERSION%3D1.1.1%26REQUEST%3DGetFeatureInfo%26LAYERS%3DOR_wild_wkspc%253AExistingWildWebMerc%2COR_wild_wkspc%253AProposedWildWebMerc%26QUERY_LAYERS%3DOR_wild_wkspc%253AExistingWildWebMerc%2COR_wild_wkspc%253AProposedWildWebMerc%26STYLES%3D%2C%26BBOX%3D-14061041.537506%252C5096118.80202%252C-12776899.462494%252C5842144.19798%26FEATURE_COUNT%3D10%26HEIGHT%3D610%26WIDTH%3D1050%26FORMAT%3Dimage%252Fpng%26INFO_FORMAT%3Dtext%252Fhtml%26SRS%3DEPSG%253A900913%26X%3D409%26Y%3D296. Origin http://www.greengeography.org is not allowed by Access-Control-Allow-Origin. OpenLayers.js:516Uncaught TypeError: Cannot read property 'x' of null
If you feel I should've been able to solve this given that there have been so many similar questions asked already, that's fine, but please don't down vote it, because I did do my research.
