[Geoserver-devel] Trying to call request on Apache Server

Hello,

I am facing one problem while working on GeoServer. I am working on
getfeatureinfo. I have written a Java script for my application where I am
trying to send the request using URL on Geoserver (i.e localhost:8080) which
I want it to reflect on Apache Server. But unfortunately it is reflecting on
Geoserver not on Apache Server URL (i.e localhost:8081).

The code is written here, if someone can please help me out to resolve my
problem, it will be highly appreciable.

Code:
map.events.register('click', map, function (e) {
    
                    document.getElementById('nodelist').innerHTML =
"Loading... please wait...";
                    var params = {
                        REQUEST: "GetFeatureInfo",
                        EXCEPTIONS: "application/vnd.ogc.se_xml",
                        BBOX: map.getExtent().toBBOX(),
                        SERVICE: "WMS",
                        INFO_FORMAT: 'text/html',
                        QUERY_LAYERS: map.layers[6].params.LAYERS,
                        FEATURE_COUNT: 50,
                        Layers: 'poll_camp:abdasa_pre',
                        WIDTH: map.size.w,
                        HEIGHT: map.size.h,
                        format: format,
                        styles: map.layers[6].params.STYLES,
                        srs: map.layers[6].params.SRS};
                    
                    // handle the wms 1.3 vs wms 1.1 madness
                    if(map.layers[0].params.VERSION == "1.3.0") {
                        params.version = "1.3.0";
                        params.j = parseInt(e.xy.x);
                        params.i = parseInt(e.xy.y);
                    } else {
                        params.version = "1.1.1";
                        params.x = parseInt(e.xy.x);
                        params.y = parseInt(e.xy.y);
                    }
                     
                    // merge filters
                 
OpenLayers.loadURL("http://192.168.10.225:8080/geoserver/wms", params, this,
setHTML, setHTML);
                    
                     OpenLayers.Event.stop(e);
                });
Calls Function setHTML from given below code:

function setHTML(response){
   alert(response);
                document.getElementById('nodelist').innerHTML =
response.responseText;
             }

Please guide me if I have missed out something on my above pasted code. Its
urgent!

Thanks,
Krunal

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Trying-to-call-request-on-Apache-Server-tp5005192.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.

It sounds as though you are running into the Same-Origin Policy enforced by all modern browsers: http://en.wikipedia.org/wiki/Same_origin_policy

The usual technique for dealing with this is to use Apache to proxy GeoServer so that it appears on the same port as your OpenLayers application. You can use the ProxyPass directive (enabled by the mod_proxy and mod_proxy_http modules) to configure this.


David Winslow
OpenGeo - http://opengeo.org/

On Fri, Sep 28, 2012 at 8:08 AM, krunal <krunalrp15@anonymised.com> wrote:

Hello,

I am facing one problem while working on GeoServer. I am working on
getfeatureinfo. I have written a Java script for my application where I am
trying to send the request using URL on Geoserver (i.e localhost:8080) which
I want it to reflect on Apache Server. But unfortunately it is reflecting on
Geoserver not on Apache Server URL (i.e localhost:8081).

The code is written here, if someone can please help me out to resolve my
problem, it will be highly appreciable.

Code:
map.events.register(‘click’, map, function (e) {

document.getElementById(‘nodelist’).innerHTML =
“Loading… please wait…”;
var params = {
REQUEST: “GetFeatureInfo”,
EXCEPTIONS: “application/vnd.ogc.se_xml”,
BBOX: map.getExtent().toBBOX(),
SERVICE: “WMS”,
INFO_FORMAT: ‘text/html’,
QUERY_LAYERS: map.layers[6].params.LAYERS,
FEATURE_COUNT: 50,
Layers: ‘poll_camp:abdasa_pre’,
WIDTH: map.size.w,
HEIGHT: map.size.h,
format: format,
styles: map.layers[6].params.STYLES,
srs: map.layers[6].params.SRS};

// handle the wms 1.3 vs wms 1.1 madness
if(map.layers[0].params.VERSION == “1.3.0”) {
params.version = “1.3.0”;
params.j = parseInt(e.xy.x);
params.i = parseInt(e.xy.y);
} else {
params.version = “1.1.1”;
params.x = parseInt(e.xy.x);
params.y = parseInt(e.xy.y);
}

// merge filters

OpenLayers.loadURL(“http://192.168.10.225:8080/geoserver/wms”, params, this,
setHTML, setHTML);

OpenLayers.Event.stop(e);
});
Calls Function setHTML from given below code:

function setHTML(response){
alert(response);
document.getElementById(‘nodelist’).innerHTML =
response.responseText;
}

Please guide me if I have missed out something on my above pasted code. Its
urgent!

Thanks,
Krunal


View this message in context: http://osgeo-org.1560.n6.nabble.com/Trying-to-call-request-on-Apache-Server-tp5005192.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.


Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html


Geoserver-devel mailing list
Geoserver-devel@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel