In my example, I am proxying a GetLegendGraphic request from MapCache to a backend WMS service.
However the tileset name in Mapcache is different than the Layer name in Mapserver.
In this example, the Mapcache tileset name is "Brisbane" and the corresponding Mapserver layer name is "HiResBNEColoured".
I can set up a forwarding rule that looks like this:
<forwarding_rule name="forward_eta_legend">
<param name="SERVICE" type="values">
<value>WMS</value>
</param>
<param name="LAYER" type="values">
<value>Brisbane</value>
</param>
<param name="REQUEST" type="values">
<value>GetLegendGraphic</value>
</param>
<http>
<url>http://localhost:8080/mapserver?SERVICE=WMS&LAYER=HiResBNEColoured</url>
</http>
</forwarding_rule>
However this doesn't work, because mapcache appends all parameters to the proxied request, so Mapserver receives a request that looks like this:
https://localhost:8080/mapserver?SERVICE=WMS&LAYER=HiResBNEColoured&SERVICE=WMS&VERSION=1.1.0&REQUEST=GetLegendGraphic&LAYER=Brisbane
So Mapserver gets two values for LAYER, with the proxied one appearing after the given on the URL parameter, and it seems Mapserver chooses the one which appears last, so it returns a "Layer not found" error.
Solution: It would be ideal to allow the forwarding rule to be configured to modify proxied parameters according to some given rules.
For example, this would be great:
<forwarding_rule name="forward_eta_legend">
<param name="SERVICE" type="values">
<value>WMS</value>
</param>
<param name="LAYER" type="values">
<value>Brisbane</value>
</param>
<param name="REQUEST" type="values">
<value>GetLegendGraphic</value>
</param>
<http>
<url>http://localhost:8080/mapserver</url>
<param name="LAYER">HiResBNEColoured</param>
<param name="VERSION">1.1.0</param>
</http>
</forwarding_rule>
In my example, I am proxying a GetLegendGraphic request from MapCache to a backend WMS service.
However the tileset name in Mapcache is different than the Layer name in Mapserver.
In this example, the Mapcache tileset name is "Brisbane" and the corresponding Mapserver layer name is "HiResBNEColoured".
I can set up a forwarding rule that looks like this:
However this doesn't work, because mapcache appends all parameters to the proxied request, so Mapserver receives a request that looks like this:
So Mapserver gets two values for LAYER, with the proxied one appearing after the given on the URL parameter, and it seems Mapserver chooses the one which appears last, so it returns a "Layer not found" error.
Solution: It would be ideal to allow the forwarding rule to be configured to modify proxied parameters according to some given rules.
For example, this would be great: