From 088fe3c270b3db3f5a3f5159678a3e1afe7ddc11 Mon Sep 17 00:00:00 2001 From: Arend Hummeling <112398219+arendhummeling@users.noreply.github.com> Date: Fri, 17 Nov 2023 16:30:06 +0100 Subject: [PATCH] docs: improve errorpages examples to avoid confusion --- docs/content/middlewares/http/errorpages.md | 36 +++++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/docs/content/middlewares/http/errorpages.md b/docs/content/middlewares/http/errorpages.md index 7f2c98f14..f4c03e725 100644 --- a/docs/content/middlewares/http/errorpages.md +++ b/docs/content/middlewares/http/errorpages.md @@ -21,7 +21,7 @@ The Errors middleware returns a custom page in lieu of the default, according to ```yaml tab="Docker" # Dynamic Custom Error Page for 5XX Status Code labels: - - "traefik.http.middlewares.test-errors.errors.status=500-599" + - "traefik.http.middlewares.test-errors.errors.status=500,501,503,505-599" - "traefik.http.middlewares.test-errors.errors.service=serviceError" - "traefik.http.middlewares.test-errors.errors.query=/{status}.html" ``` @@ -34,7 +34,10 @@ metadata: spec: errors: status: - - "500-599" + - "500" + - "501" + - "503" + - "505-599" query: /{status}.html service: name: whoami @@ -42,36 +45,39 @@ spec: ``` ```yaml tab="Consul Catalog" -# Dynamic Custom Error Page for 5XX Status Code -- "traefik.http.middlewares.test-errors.errors.status=500-599" +# Dynamic Custom Error Page for 5XX Status Code excluding 502 and 504 +- "traefik.http.middlewares.test-errors.errors.status=500,501,503,505-599" - "traefik.http.middlewares.test-errors.errors.service=serviceError" - "traefik.http.middlewares.test-errors.errors.query=/{status}.html" ``` ```json tab="Marathon" "labels": { - "traefik.http.middlewares.test-errors.errors.status": "500-599", + "traefik.http.middlewares.test-errors.errors.status": "500,501,503,505-599", "traefik.http.middlewares.test-errors.errors.service": "serviceError", "traefik.http.middlewares.test-errors.errors.query": "/{status}.html" } ``` ```yaml tab="Rancher" -# Dynamic Custom Error Page for 5XX Status Code +# Dynamic Custom Error Page for 5XX Status Code excluding 502 and 504 labels: - - "traefik.http.middlewares.test-errors.errors.status=500-599" + - "traefik.http.middlewares.test-errors.errors.status=500,501,503,505-599" - "traefik.http.middlewares.test-errors.errors.service=serviceError" - "traefik.http.middlewares.test-errors.errors.query=/{status}.html" ``` ```yaml tab="File (YAML)" -# Custom Error Page for 5XX +# Dynamic Custom Error Page for 5XX Status Code excluding 502 and 504 http: middlewares: test-errors: errors: status: - - "500-599" + - "500" + - "501" + - "503" + - "505-599" service: serviceError query: "/{status}.html" @@ -80,10 +86,10 @@ http: ``` ```toml tab="File (TOML)" -# Custom Error Page for 5XX +# Dynamic Custom Error Page for 5XX Status Code excluding 502 and 504 [http.middlewares] [http.middlewares.test-errors.errors] - status = ["500-599"] + status = ["500","501","503","505-599"] service = "serviceError" query = "/{status}.html" @@ -101,14 +107,16 @@ http: The `status` option defines which status or range of statuses should result in an error page. -The status code ranges are inclusive (`500-599` will trigger with every code between `500` and `599`, `500` and `599` included). +The status code ranges are inclusive (`505-599` will trigger with every code between `505` and `599`, `505` and `599` included). !!! note "" You can define either a status code as a number (`500`), as multiple comma-separated numbers (`500,502`), - as ranges by separating two codes with a dash (`500-599`), - or a combination of the two (`404,418,500-599`). + as ranges by separating two codes with a dash (`505-599`), + or a combination of the two (`404,418,505-599`). + The comma-separated syntax is only available for label-based providers. + The examples above demonstrate which syntax is appropriate for each provider. ### `service`