Ticket #3552 (new defect)
Add [mapserv_url] template tag
|Reported by:||dmorissette||Owned by:||dmorissette|
|Component:||MapServer C Library||Version:||unspecified|
|Cc:||sdlime, aboudreault, jmckenna|
The template parser currently lacks a mechanism to return the complete URL of the mapserv CGI. (This came up while working on ticket #3549)
We could add a [mapserv_url] (better name welcome) template tag that would use msOWSGetOnlineResource() (mapows.c) or a modified version of it to return the complete mapserv CGI URL, including protocol prefix ( http:// vs https://), hostname, optional port number, and script_name (full path to mapserv CGI).
Note that msOWSGetOnlineResource() also includes the map=... param in the URL if it was explicitly provided by the caller (i.e. not set vis MS_MAPFILE env. var.), and finally it terminates the URL with either "?" or "&" so that you are ready to add more params to it.
The only issue with this automatic URL detection is if you are working behind a proxy: in this case you get the internal URL and not the proxy's public URL. To address this, msOWSGetOnlineResource() checks the ows_onlineresource metadata and uses its value in precedence if it is set. We would need a similar (and more generic) setting for the new [mapserv_url] tag.