Does the caddy support regular expressions?

(Loli Squad) #1


proxy ^~/api/ localhost:9005 {


Does caddy support this?

(Matthew Fay) #2

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

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).

(Loli Squad) #3

Thank you~