You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api.md
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -746,6 +746,48 @@ Response includes the updated `raw` YAML and `parsed` object.
746
746
747
747
---
748
748
749
+
### `POST /api/static/trusted-ips/preview`
750
+
751
+
Compute the result of adding `forwardedHeaders.trustedIPs` to an entrypoint, without writing anything to disk. Backs the **Trusted IPs** helper in the Static Config editor.
752
+
753
+
Trusting a proxy's IP makes Traefik believe its `X-Forwarded-For`, which then feeds the access logs, CrowdSec, `ipAllowList`, and the login rate-limiter. Only trust proxies you control.
754
+
755
+
The merge is **additive with dedup**: existing entries are kept, and ranges already covered are skipped by normalized network (so `10.5.5.5/8` will not re-add `10.0.0.0/8`). Sibling keys under `forwardedHeaders`, other entrypoints, and YAML comments are all preserved. The endpoint never saves - the returned `raw` is persisted by the client through [`POST /api/static/config`](#post-api-static-config), which is why it works identically on the Host and on a remote agent.
756
+
757
+
Called in two modes.
758
+
759
+
**Inspect** (no `entrypoint`) - lists entrypoints and the presets:
|`current_raw`| string | Static config YAML to operate on. Falls back to the file on disk when empty. |
780
+
|`entrypoint`| string | Target entrypoint. Omit for inspect mode. |
781
+
|`cloudflare`| boolean | Include the built-in Cloudflare edge ranges. |
782
+
|`private`| boolean | Include the private-range preset (`10/8`, `172.16/12`, `192.168/16`, `fc00::/7`). |
783
+
|`custom_cidrs`| string \| string[]| Extra CIDRs or IPs, comma/whitespace-separated or an array. Invalid entries are returned in `invalid` and skipped. |
784
+
785
+
Inspect mode returns `ok`, `entrypoints` (each with `name`, `address`, `trusted_ips`), `cloudflare_captured`, `cloudflare_ranges`, and `private_ranges`. Preview mode adds `entrypoint`, `existing`, `added`, `invalid`, `final`, the merged `raw` YAML, and the `parsed` object.
786
+
787
+
Returns `400` if the named entrypoint is absent or the config is not a mapping, and `404` if there is no static config on disk and no `current_raw` was supplied.
0 commit comments