Reputation: 800
As it is said in http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost I did put the proxy.cgi file in server where documentation is saying and It is showing the openlayer page while go to "http://mydomain.com/cgi-bin/proxy.cgi". That means proxy set up is correctly done for the server. but while I try at my script use this proxy it is not working.
I put "OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
" in my script. so that the proxy can be used.
My code is here which is not working.
ainSelect = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://ec2-23-22-12-137.compute-1.amazonaws.com:8080/geoserver/KCRE/wms',
title: 'Identify features by clicking',
layers: [lyrParcels],
queryVisible: true
});
ainSelect.infoFormat = 'application/vnd.ogc.gml';
ainSelect.events.register("getfeatureinfo", this, pickAINid);
map.addControl(ainSelect);
ainSelect.activate();
And pickAINid function is:
function pickAINid(e) {
//alert(e.features.length);
if (e.features && e.features.length) {
var val = e.features[0].attributes.ain;
alert(val);
//document.getElementById('roadId').value = val;
}
}
So it should alert me the AIN number while i click on the map. As far as I've got it is getting e.features.length = 0. that means WMSGetFeatureInfo is not working correctly.
Please see that I've used the layers:[lyrParcels] I created that layer before which code i haven't give here.
Another point. this code is just working fine while I run this code from my local.
Can anyone tell me what am I doing wrong? Is it on this "OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
" line?
Thanks in advance.
regards Mahbubul Haque
Upvotes: 3
Views: 5067
Reputation: 11865
in the proxy.cgi there is a list of allowed host at the top of the file ( like below).
allowedHosts = ['www.openlayers.org', 'openlayers.org',
'labs.metacarta.com', 'world.freemap.in',
'prototype.openmnnd.org', 'geo.openplans.org',
'sigma.openplans.org', 'demo.opengeo.org',
'www.openstreetmap.org', 'sample.azavea.com',
'v2.suite.opengeo.org', 'v-swe.uni-muenster.de:8080',
'vmap0.tiles.osgeo.org', 'www.openrouteservice.org']
If you havent you need to add the domain(and port in your case as its not 80) of the server you are contacting, in this case :
ec2-23-22-12-137.compute-1.amazonaws.com:8080
If this is not the source of the problem could you provide some more info from a javascript debugger such as firebug showing any errors or warning when you try to make the request through the proxy.
UPDATE
Its seems from testing your proxy on your server that you have an issue connection to port 8080 from inside your network.
this can be tested by trying the urls
http://kleincom.com/cgi-bin/proxy.cgi?url=http://v-swe.uni-muenster.de:8080
and
http://kleincom.com/cgi-bin/proxy.cgi?url=http://labs.metacarta.com
The metacarta url works fine but the muenster url fails with a timeout issue. I would have a look at your out going firewall setting or similar.
Upvotes: 1