[OpenLayers-Users] OpenLayers.Layer.WMS Proxy

Diego Guidi diegoguidi at gmail.com
Thu Mar 7 06:24:47 PST 2013


> My question is if OpenLayers.Layer.WMS accepts the ProxyHost configuration
> from OpenLayers or if it is possible to make OpenLayers.Layer.WMS pass
> through proxy. In my tests it looks like it doesnt.
ProxyHost isn't used at all for WMS requests, but you can easily patch
the layer to use it.

var myWMS = OpenLayers.Class(OpenLayers.Layer.WMS, {

    getURL: function (bounds) {
        var url = OpenLayers.Layer.WMS.prototype.getURL.call(this, bounds);
        if (OpenLayers.ProxyHost && OpenLayers.String.startsWith(url, "http")) {
            url = OpenLayers.ProxyHost + encodeURIComponent(url);
        }
        return url;
    }
});


More information about the Users mailing list