I am using the OpenLayers/GeoServer stack and my WMS requests are configured to go via a proxy using the following:
OpenLayers.ProxyHost="../gis/geoserver.seam?url=";
So far so good, all future WMS request are now channelled through this proxy script and WMS images are generated/returned as expected.
My problem arises when viewing the legend, the request to get the layer image (WMS request) ignores the OpenLayers proxy definition and tries connecting direct (client browser->geoserver server which is not externally accessible - hence the proxy).
How can I force the legend image requests to use the proxy?
//override the default wms object and send all traffic through the proxy var proxyWMS = 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; }});