caddy_remove_route
Remove a Caddy route by stable @id or index, with confirmation to prevent accidental deletion. Idempotent by @id; index removal can target different routes after reordering.
Instructions
Remove a route. Target by @id (preferred — stable across reorderings) or by array index on a specific server. Index-based removal is a two-step read-then-delete and can race against concurrent edits; prefer @id when possible. Only the @id mode is idempotent: a repeat call cannot remove a different route, it just reports the id as gone. The index mode is NOT — Caddy re-packs the routes array after a removal, so calling with index 2 twice removes TWO DIFFERENT routes. @ids are config-global in Caddy (NOT route-scoped): if id resolves to a non-route object (TLS issuer, server, etc.) the call refuses rather than deleting it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | The @id of the route to remove (preferred — stable even if routes get reordered) | |
| index | No | Zero-based index of the route in the server's routes array (only used if id is not provided) | |
| server | No | Caddy server name when using index (default: srv0). Ignored when id is provided. | srv0 |
| confirm | No | Must be true to actually remove the route (safety) |