Allow redirecting based on datetime placeholders like {when_unix}
. The http.rewrite conditions currently do not allow something like greater_than
or less_than
for comparing integers.
It would be very useful to allow specifying a date after which a redirect should occur, e.g. after a deprecation deadline.
Manually editing the Caddyfile after the deadline to redirect users to the new address.
This is really easy to add to Caddy 2. Interested in contributing it?
Pending on https://github.com/google/cel-go/issues/357
@SteffenDE Here's how to do it with the expression matcher (in v2.1)
@then expression `{time.now} > timestamp(1590106550)`
(The backticks aren't necessary in this case, but I like to enclose the expression in a single token for readability.)
You can also pass an RFC3339-formatted string into CEL's timestamp()
function to make it a timestamp.
Most helpful comment
@SteffenDE Here's how to do it with the expression matcher (in v2.1)
(The backticks aren't necessary in this case, but I like to enclose the expression in a single token for readability.)
You can also pass an RFC3339-formatted string into CEL's
timestamp()
function to make it a timestamp.