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!
Caddy 2 is beta software. It is ready for production, but some things will change between releases; check the release notes before upgrading.


Strips a given prefix from the request URI's path. If a matched request does not have the given path prefix, this directive is a no-op.


strip_prefix [<matcher>] <prefix>
  • <prefix> is the prefix to strip from the request path. This value may omit the leading forward slash / and it will be assumed.


Strip api/ from the beginning of all request paths:

strip_prefix api/

An alternate way to describe the same thing, using a matcher:

strip_prefix /api/* /api