[OpenLayers-Users] using a proxy

Christopher Schmidt crschmidt at metacarta.com
Thu Aug 21 10:08:24 EDT 2008


On Thu, Aug 21, 2008 at 01:30:44AM -0700, LaurentPierre wrote:
> 
> Hi,
> 
> I'm trying to use a proxy with openlayers in order to request ws on
> different ports than the site (on the same machine in facts).  In order to
> do that I set the proxy in the code but not all the calls are made through
> it  :
> 
> var url =  map.layers[0].getFullRequestString(.....  generates a call
> through the proxy 
> while this one
> new OpenLayers.Layer.WMS("edfgeo:departement - Tiled",
> "http://localhost:8080/geoserver/wms", ....
> no.

WMS Requests don't use a proxy. (They don't need to...) If you want a
proxy on a WMS request, just make the URL of the WMS point to a proxy:
http://localhost/cgi-bin/proxy.cgi?url=http://localhost/geoserver . 
but in the general case, there's no need to do this, because browsers
can request image tags from other servers, and this will simply
double the neccesary bandwidth to serve your tiles (once to the proxy,
once to the outside world).  

-- Chris

> Here's the 2 firebug traces :
> 
> http://localhost/cgi-bin/proxy.py?url=http%3A%2F%2Flocalhost%3A8080%2Fgeoserver%2Fwms%3FSTYLES%3D%26LAYERS%3Dedfgeo%253Apactedep%26WIDTH%3D800%26HEIGHT%3D560%26SRS%3DEPSG%253A2154%26FORMAT%3Dimage%252Fpng%26SERVICE%3DWMS%26VERSION%3D1.1.1%26REQUEST%3DGetFeatureInfo%26EXCEPTIONS%3Dapplication%252Fvnd.ogc.se_xml%26BBOX%3D753290.28095%252C6200497.152087%252C899406.792137%252C6302778.709918%26X%3D55%26Y%3D119%26INFO_FORMAT%3Dtext%252Fhtml%26QUERY_LAYERS%3Dedfgeo%253Adepartement%26FEATURE_COUNT%3D50
> 
> http://localhost:8080/geoserver/wms?STYLES=&LAYERS=edfgeo%3Apactedep&WIDTH=1200&HEIGHT=840&SRS=EPSG%3A2154&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&BBOX=825492.3851108723,6251038.624999397,827204.6879763438,6252237.237005227
> 
> and a code fragment :
> 
> 		
> .......
> 	function showName(e){
> 			var url =  map.layers[0].getFullRequestString(
>                     {
>                         REQUEST: "GetFeatureInfo",
>                         EXCEPTIONS: "application/vnd.ogc.se_xml",
>                         BBOX: map.getExtent().toBBOX(),
>                         X: e.xy.x,
>                         Y: e.xy.y,
>                         INFO_FORMAT: 'text/html',
>                         QUERY_LAYERS: map.layers[2].params.LAYERS,
>                         FEATURE_COUNT: 50,
>                         WIDTH: map.size.w,
>                         HEIGHT: map.size.h
>                     },
>                     "http://localhost:8080/geoserver/wms"
>                 );
> .......
>         function init(){
> 	    OpenLayers.ProxyHost="/cgi-bin/proxy.py?url=";
> 
> 	    toolTip = document.getElementById("toolTip");
> 
>             var bounds = new OpenLayers.Bounds(
>                 -82496.16303893644, 5966463.161241372,
>                 1413736.911514963, 7198720.496439878
>             );
>             var options = {
>                 controls: [],
>                 maxExtent: bounds,
>                 maxResolution: 5844.66044747617,
>                 projection: "EPSG:2154",
>                 units: 'm'
>             };
>             map = new OpenLayers.Map('map', options);
>             
>             
>             // setup tiled layer
>             tiled = new OpenLayers.Layer.WMS(
>                 "edfgeo:departement - Tiled",
> "http://localhost:8080/geoserver/wms",
>                 {
>                     styles: '',
>                     layers: 'edfgeo:departement',
>                     width: '800',
>                     height: '618',
>                     srs: 'EPSG:2154',
>                     format: 'image/png',
>                     tiled: 'true',
>                     tilesOrigin : "-82496.16303893644,5966463.161241372"
>                 },
>                 {buffer: 0} 
>             );
> .......
> 
> 
> Is it a known problem or did I make a mistake ?
> 
> Thanks
> 
> Laurent Pierre
> 
> -- 
> View this message in context: http://www.nabble.com/using-a-proxy-tp19084627p19084627.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list