api-platform
api-platform copied to clipboard
Caddyfile: Use enhanced expression matcher
In Caddy v2.5.2 released last month, the expression matcher was upgraded in https://github.com/caddyserver/caddy/pull/4715 to embed the other main built-in matchers as functions inside of the CEL expressions.
This makes it possible to more elegantly configure the @pwa matcher in the API Platform Caddyfile.
I didn't test this, as I don't use APIP, but I think this should be correct.
Notably, this uses the expression syntax for header and path. In the case of the path matcher, it's case insensitive, so that replaces the (?i) in the regexp.
The docs in https://api-platform.com/docs/distribution/caddy/ will need to be updated as well, after this is merged.
For the record, this can be tested locally by just running docker compose up.
Then load https://localhost and click on the buttons allowing to access the various API Platform components.
I just tested the patch, and it works! Thanks @francislavoie.