Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm refactoring the code used to getfeatureinfo from geoserver running on port 8080 at http://www.edpp.cz/zul_mapa-povodnoveho-planu-mesta/. The old version uses OpenLayers.loadURL and successfully requests the response from the server. The code is like:

map.events.register('click', map, function (e) {            
        var params = {
                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: 'text/html',
                QUERY_LAYERS: layers_on,
                FEATURE_COUNT: 1,
                Layers: layers_on,
                Styles: '',
                WIDTH: map.size.w,
                HEIGHT: map.size.h,
                format: format,
                srs: map.layers[0].params.SRS};

                OpenLayers.loadURL("http://localhost:8080/geoserver/wms", params, this, setHTML, setHTML);
                OpenLayers.loadURL("http://www.edpp.cz/mapinfo/geoserver/wms", params, this, setHTML, setHTML);


With the new code I try something like this:

popup = new OpenLayers.Control.WMSGetFeatureInfo({
            url: offline ? 'http://localhost:8080/geoserver/wms' : 'http://www.edpp.cz/mapinfo/geoserver/wms',
            layers: unbaseLayers,
            layerUrls: offline ? ['http://localhost:8080/geoserver/wms'] : ['http://www.edpp.cz/mapinfo/geoserver/wms'],
            title: 'Identify features by clicking',
            queryVisible: true,
            maxFeatures: 1,
            eventListeners: {
                getfeatureinfo: function(event) {
                    if (console) {
                    if (event.text.length > 1088) { // nezobrazí prázdné bubliny
                        map.addPopup(new OpenLayers.Popup.FramedCloud(
                nogetfeatureinfo: function(event) {
                    if (console) {

If I look into Firebug network log, I see that the clicking the map doesn't send any request to the geoserver (it runs fine on localhost though). Is this just a proxy related problem? I've already read about need to set up a proxy when running geoserver on the different port than a website. But it's really puzzling me there is no request being sent. Might it be a typo? I can't see any.

What if I am not able to set up a proxy, do I have any other option?

PS: All I get as a result is object of nogetfeatureinfo type.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

The problem is the cross-domain request. The problem is not related on which port Geoserver is listening, the problem is that you can't do an AJAX request (getFeatureInfo in your case) on different domains.

See http://en.wikipedia.org/wiki/Same_origin_policy

share|improve this answer
add comment

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.