Skip to content

[Feature] allow forwarding rule to overwrite proxied parameters #288

Description

@ashleysommer

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&amp;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>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions