Does the caddy support regular expressions?

Example:

proxy ^~/api/ localhost:9005 {

}

Does caddy support this?

You can not use Regular Expressions for the from value in a proxy directive.

  • from is the base path to match for the request to be proxied

https://caddyserver.com/docs/proxy

My understanding is that ^~ as a regex prefix in nginx will actually stop regex from being checked if that particular location block is the “winning” (longest matching) prefix anyway. This is consistent with the native Caddy proxy behaviour (for multiple proxy directives, the longest matching/most specific from base path is selected).

Thank you~

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.