@@ -6,9 +6,9 @@ MS RFC 141: MapServer CONFIG MS_ONLINERESOURCE
66
77:Author: Seth Girvin
88:Contact: sethg@geographika.co.uk
9- :Last Updated: 2026-02-06
9+ :Last Updated: 2026-02-27
1010:Version: MapServer 8.8
11- :Status: Proposed
11+ :Status: Adopted
1212
1313Overview
1414--------
@@ -114,12 +114,44 @@ Users will be able to add the new environment variable to the ``CONFIG`` file as
114114
115115 CONFIG
116116 ENV
117- MS_ONLINERESOURCE "http://localhost/test/"
117+ MS_ONLINERESOURCE "https://maps.example.com/"
118+ END
119+ MAPS
120+ EXAMPLE "/data/mapfiles/example.map"
121+ END
122+ END
123+
124+ When accessing the Mapfile using its key (``EXAMPLE`` in the above example), a request
125+ such as https://maps.example.com/example/?service=wms&version=1.3.0&request=GetCapabilities will return a
126+ GetCapabilities response with the base URL set to ``https://maps.example.com/``.
127+
128+ .. code-block:: xml
129+
130+ <WMS_Capabilities>
131+ <Service>
132+ <Name>WMS</Name>
133+ <Title>Example</Title>
134+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://maps.example.com/example/?"/>
135+
136+ When accessing a Mapfile using the ``&map=`` parameter, this will be appended to the ``MS_ONLINERESOURCE`` URL.
137+ For example, a request to https://maps.example.com/?map=/data/mapfiles/example.map&service=wms&version=1.3.0&request=GetCapabilities
138+ will return a GetCapabilities response including the following:
139+
140+ .. code-block:: xml
141+
142+ <HTTP>
143+ <Get>
144+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://maps.example.com/?map=/data/mapfiles/example.map&"/>
145+ </Get>
146+
147+ For OGC API URLs requests such as https://maps.example.com/example/ogcapi/?f=json will return URLs in
148+ the format https://maps.example.com/example/ogcapi/collections?f=html.
118149
119150Notes:
120151
121- - Existing ``*_onlineresource`` metadata in a Mapfile will take precedence over
122- the ``CONFIG`` setting.
152+ - In any of the above examples, if the ``example.map`` contained ``ows_onlineresource``
153+ (or a more specific variant such as ``wms_onlineresource`` or ``oga_onlineresource``)
154+ then these would take precedence over the ``CONFIG`` setting and be used instead.
123155
124156- If ``MS_ONLINERESOURCE`` is set to an empty string, the resulting base URL
125157 will be empty. Users are responsible for providing a valid URL for their
@@ -130,6 +162,21 @@ Notes:
130162 multiple variables such as ``MS_WMS_ONLINERESOURCE`` or
131163 ``MS_WFS_ONLINERESOURCE`` would add unnecessary complexity.
132164
165+ - ``?`` will be appended to the end of the URL for building OWS URLs, to ensure that query parameters are appended correctly.
166+
167+ - MAP keys are resolved relative to MS_ONLINERESOURCE, and only one root URL can be configured per CGI instance.
168+ For example, you cannot simultaneously use:
169+
170+ + https://maps.example.com/dev/example/
171+ + https://maps.example.com/prod/example/
172+
173+ or separate hostnames such as:
174+
175+ + https://wms.example.com
176+ + https://wfs.example.com
177+
178+ To support these scenarios, you would need to deploy separate MapServer CGI applications with different CONFIG files.
179+
133180Testing
134181-------
135182
@@ -138,6 +185,7 @@ and Mapfile setups, including:
138185
139186- Cases with and without a ``MS_ONLINERESOURCE`` setting
140187- The case where ``MS_ONLINERESOURCE`` is set to an empty string
188+ - Use of ``map=`` parameter in requests
141189
142190Security Concerns
143191-----------------
@@ -169,12 +217,16 @@ Affected files
169217Ticket Reference
170218----------------
171219
172- TODO
220+ + https://github.com/MapServer/MapServer/pull/7434
173221
174222Documentation
175223-------------
176224
225+ + https://github.com/MapServer/MapServer-documentation/pull/1062
226+
177227Voting History
178228--------------
179229
180- TODO
230+ +1 from PSC members TomK, SethG, MikeS, DanielM, JeromeB, SteveL, EvenR, JeffM, JukkaR
231+
232+ See https://lists.osgeo.org/pipermail/mapserver-dev/2026-February/017342.html for discussion and voting.
0 commit comments