From c6ea47c0208747926edb8adaf9f5ff30c38fa21b Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 9 Dec 2024 17:16:53 +0100 Subject: [PATCH] Document MS_WMS_ERROR_STATUS_CODE added in https://github.com/MapServer/MapServer/pull/7191 --- en/mapfile/config.txt | 1 + en/ogc/wms_server.txt | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/en/mapfile/config.txt b/en/mapfile/config.txt index 7e2092f1646..f851ccc9edd 100644 --- a/en/mapfile/config.txt +++ b/en/mapfile/config.txt @@ -154,6 +154,7 @@ A full sample config file is shown below: # MS_OPENLAYERS_JS_URL "http://openlayers.org/api/OpenLayers.js" # MS_TEMPPATH "/tmp" # MS_MAX_OPEN_FILES 200 # maximum number of open files allowed on Windows + # MS_WMS_ERROR_STATUS_CODE "ON" # enable HTTP status code 4xx and 5xx in case of errors on WMS requests END # diff --git a/en/ogc/wms_server.txt b/en/ogc/wms_server.txt index a9095373710..20967758377 100644 --- a/en/ogc/wms_server.txt +++ b/en/ogc/wms_server.txt @@ -2165,6 +2165,37 @@ Vendor specific WMS parameters .. index:: pair: WMS; Cascading requests +HTTP status error codes +----------------------- + +The OGC WMS specification is not explicit about which HTTP status error code +servers should return in case of errors. Traditionaly most WMS implementation +return "200 OK" in those situations. Starting with MapServer 8.4, it is +possible to define the ``MS_WMS_ERROR_STATUS_CODE`` configuration option to ``ON`` +in the CONFIG.ENV section of the MapServer configuration file to ask MapServer +to return HTTP 4xx or 5xx status codes in case of error. + + +.. code-block:: mapfile + + + CONFIG + # + # Environment variables + # + ENV + # + # Limit Mapfile Access + # + # MS_MAP_NO_PATH "1" + MS_MAP_PATTERN "^/opt/mapserver" ## required when referencing mapfiles by path + # MS_MAP_BAD_PATTERN "[/\\]{2}|[/\\]?\\.+[/\\]|," + + # Enable HTTP status code 4xx and 5xx in case of errors on WMS requests + MS_WMS_ERROR_STATUS_CODE "ON" + END + END + Cascading WMS Requests ----------------------