diff --git a/docs/content/middlewares/http/ipallowlist.md b/docs/content/middlewares/http/ipallowlist.md index 63c6028fe..60565fd90 100644 --- a/docs/content/middlewares/http/ipallowlist.md +++ b/docs/content/middlewares/http/ipallowlist.md @@ -264,3 +264,45 @@ http: [http.middlewares.test-ipallowlist.ipallowlist.sourceCriterion.ipStrategy] ipv6Subnet = 64 ``` + +### `rejectStatusCode` + +The `rejectStatusCode` option sets HTTP status code for refused requests. If not set, the default is 403 (Forbidden). + +```yaml tab="Docker & Swarm" +# Reject requests with a 404 rather than a 403 +labels: + - "traefik.http.middlewares.test-ipallowlist.ipallowlist.rejectstatuscode=404" +``` + +```yaml tab="Kubernetes" +# Reject requests with a 404 rather than a 403 +apiVersion: traefik.io/v1alpha1 +kind: Middleware +metadata: + name: test-ipallowlist +spec: + ipAllowList: + rejectStatusCode: 404 +``` + +```yaml tab="Consul Catalog" +# Reject requests with a 404 rather than a 403 +- "traefik.http.middlewares.test-ipallowlist.ipallowlist.rejectstatuscode=404" +``` + +```yaml tab="File (YAML)" +# Reject requests with a 404 rather than a 403 +http: + middlewares: + test-ipallowlist: + ipAllowList: + rejectStatusCode: 404 +``` + +```toml tab="File (TOML)" +# Reject requests with a 404 rather than a 403 +[http.middlewares] + [http.middlewares.test-ipallowlist.ipAllowList] + rejectStatusCode = 404 +```