Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does WMSGetFeatureInfo need a proxyhost to allow remote server accessing the data? I use ProxyHost to allow WFS requests, but seems its not working with WMSGetFeatureInfo. the local machines retrieves data from GeoServer successfully but external machines doesn't!

Here is the select feature code:

    control = new OpenLayers.Control.WMSGetFeatureInfo({
        layers: [layer],
        autoActivate: true,
        maxFeatures: 3,
        hover: false,
        infoFormat: "application/vnd.ogc.gml",
        eventListeners: {
            "getfeatureinfo": function (e) {

                var activeLayer = getActiveLayer();
                if (activeLayer != "") {
                    var param = {
                        REQUEST: "GetFeatureInfo",
                        EXCEPTIONS: " application/vnd.ogc.se_xml",
                        BBOX: map.getExtent().toBBOX(),
                        SERVICE: "WMS",
                        VERSION: "1.1.1",
                        X: e.xy.x,
                        Y: e.xy.y,
                        INFO_FORMAT: 'application/vnd.ogc.gml/3.1.1',
                        QUERY_LAYERS: activeLayer.params.LAYERS,
                        Layers: activeLayer.params.LAYERS,
                        FEATURE_COUNT: 6,
                        SRS: 'EPSG:3857',
                        STYLES: activeLayer.params.STYLES,
                        WIDTH: map.size.w,
                        HEIGHT: map.size.h

                    param.cql_filter = activeLayer.params.CQL_FILTER;

               //     if (activeLayer.params.LAYERS == 'AIS:favoriteVessels');
                //    param.Viewparams = 'UID:' + userid;

                    OpenLayers.loadURL(GeoServerWMS, param, this, setHTML, setHTML);


and the GeoServerWMS is specified by:

  GeoServerWMS = 'http://MYPUBLICIP:8080/geoserver/wms'
  GeoServerWMS = 'http://privateIP:8080/geoserver/wms'

here is my allowedHosts

allowedHosts = ['localhost', 'localhost:8080','localhost:80', 'localhost:8080/geoserver',
                'PrivateIP','PrivateIP:8080', 'PrivateIP:8080/geoserver',
                'PublicIP','PublicIP:8080', 'PublicIP:8080/geoserver', 
                '', '', 

EDIT Even this event register is not working:

selectControl = new OpenLayers.Control.GetFeature({
    id: 'selectControl',
    protocol: OpenLayers.Protocol.WFS.fromWMSLayer(test, {
    url: GeoServerWMS,
        featureType: "layer"
    hover: false,
    click: true

Here is the error I get: Some unexpected error occurred. Error text was

urlopen error [Errno 110] Connection timed out

share|improve this question
Do you see any errors in Firebug? How are you accessing the wms service? Please post the code that you are using. – Devdatta Tengshe May 21 '13 at 8:36
updated my post – Shadin May 21 '13 at 8:37
Does your proxy file have MYPUBLICIP:8080 in the allowed hosts? – Devdatta Tengshe May 21 '13 at 8:57
I added them. updated my post – Shadin May 21 '13 at 9:37
what happens if you paste the url into the browser? – iant May 21 '13 at 12:02

Firstly, I'm not sure why you are using the WMSGetFeatureInfo in this particular way. The getfeatureinfo event is fired, once the control gets the data from the getfeatureinfo request on the WMS service. You just need to show the data on this event.

Please have a look at this sample, which shows a simple WMSGetFeatureInfo control being used: Feature Info in Popup

You don't need to call OpenLayers.loadURL(GeoServerWMS, param, this, setHTML, setHTML); Further more, this function is deprecated, and I'm not even sure if uses the proxy.

If on using a WMSGetFeatureInfo control, like in the given sample, does not work, I would debug the issue, with the following steps:

  • Debug the requests using both FireBug & WireShark.
  • Make sure that the server can route to itself via the external IP. In most enterprise networks, the network routing on the server is severely limited for security reasons, and often it cannot route a request to any external IP, including its own external IP address.

Here is how you would check if the proxy can route to external IP addresses:
Suppose you are using the OpenLayers Proxy like this: OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";

Then, that means that your proxy is at http://PublicIP/cgi-bin/proxy.cgi

  1. First try to open the Proxy link directly in your browser. If it is the OpenLayers Proxy.cgi file, then it will try to route you to the OpenLayers Site. See if the OpenLayers Site open up.
  2. You could also try to open up a page in your allowed hosts. You could try to open http://PublicIP/cgi-bin/proxy.cgi?url=http://PublicIP:8080/geoserver/web This should open up the Geoserver Admin Home page.
  3. You could also log on to the server and try to open a browser and browse to your external IP, or a well known public website, like Note that this is not a good idea security-wise, and your system Admin might not be happy with it.
share|improve this answer
Thank you. but I tried several versions of getfeature methods such as event register (updated my post) – Shadin May 21 '13 at 11:50
Have you checked if the proxy can route to its own external IP address? – Devdatta Tengshe May 21 '13 at 13:14
How to do that? – Shadin May 21 '13 at 16:47
1. Yes, this url [PublicIP/cgi-bin/proxy.cgi] opened the OpenLayers site. 2. I got this error: This proxy does not allow you to access that location (PublicIP:8080). – Shadin May 21 '13 at 17:57
I'm in the same situation… – Zach Aug 28 '14 at 21:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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