Skip to content

Commit 6860e77

Browse files
authored
Merge pull request MapServer#985 from rouault/MS_WMS_ERROR_STATUS_CODE
Document MS_WMS_ERROR_STATUS_CODE
2 parents 5878d17 + c6ea47c commit 6860e77

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

en/mapfile/config.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ A full sample config file is shown below:
154154
# MS_OPENLAYERS_JS_URL "http://openlayers.org/api/OpenLayers.js"
155155
# MS_TEMPPATH "/tmp"
156156
# MS_MAX_OPEN_FILES 200 # maximum number of open files allowed on Windows
157+
# MS_WMS_ERROR_STATUS_CODE "ON" # enable HTTP status code 4xx and 5xx in case of errors on WMS requests
157158
END
158159

159160
#

en/ogc/wms_server.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2165,6 +2165,37 @@ Vendor specific WMS parameters
21652165
.. index::
21662166
pair: WMS; Cascading requests
21672167

2168+
HTTP status error codes
2169+
-----------------------
2170+
2171+
The OGC WMS specification is not explicit about which HTTP status error code
2172+
servers should return in case of errors. Traditionaly most WMS implementation
2173+
return "200 OK" in those situations. Starting with MapServer 8.4, it is
2174+
possible to define the ``MS_WMS_ERROR_STATUS_CODE`` configuration option to ``ON``
2175+
in the CONFIG.ENV section of the MapServer configuration file to ask MapServer
2176+
to return HTTP 4xx or 5xx status codes in case of error.
2177+
2178+
2179+
.. code-block:: mapfile
2180+
2181+
2182+
CONFIG
2183+
#
2184+
# Environment variables
2185+
#
2186+
ENV
2187+
#
2188+
# Limit Mapfile Access
2189+
#
2190+
# MS_MAP_NO_PATH "1"
2191+
MS_MAP_PATTERN "^/opt/mapserver" ## required when referencing mapfiles by path
2192+
# MS_MAP_BAD_PATTERN "[/\\]{2}|[/\\]?\\.+[/\\]|,"
2193+
2194+
# Enable HTTP status code 4xx and 5xx in case of errors on WMS requests
2195+
MS_WMS_ERROR_STATUS_CODE "ON"
2196+
END
2197+
END
2198+
21682199
Cascading WMS Requests
21692200
----------------------
21702201

0 commit comments

Comments
 (0)