This page is about Caddy 2, which is currently in beta. Click here for the old Caddy 1 site. Thank you for your patience as we transition!
Documentation
Caddy 2 is beta software. It is ready for production, but some things will change between releases; check the release notes before upgrading.

uri_replace

Performs a substring or regular expression replacement in the request URI.

Syntax

uri_replace [<matcher>] <find> <replace> [<limit>]
  • <find> is the substring or regular expression to search for.
  • <replace> is the replacement value.
  • <limit> is an optional limit to the number of replacements.

Examples

Replace "/docs/" with "/v1/docs/" in any request URI:

uri_replace * /docs/ /v1/docs/