Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ashleysommer opened this issue Apr 28, 2022 · 0 comments
Open

Comments

@ashleysommer
Copy link

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant