Placeholders and expressions are not evaluated properly in caddyfile

1. The problem I’m having:

I’m trying to set some cookie in caddyfile and match on whether it’s present. The cookie has a variable value. It seems none of my expressions/placeholders are evaluated properly.

The cookie set stays with {} and expression is not evaluated.

When I manually set the cookie in console, it seems the matcher is not evaluated either because the condition is false.

By the way, it’d be nice if it was possible to let the config emit debug logs to test what some expressions are evaluated to, etc.

2. Error messages and/or full log output:

no error message

3. Caddy version:

2.11.4

4. How I installed and ran Caddy:

a. System environment:

b. Command:

caddy run

d. My complete Caddy config:

{
	admin off
}

http://localhost:7777 {
	@allowed {
		expression {http.request.cookie.valid} == "{now | date '2006-01-02'}"
	}

	handle {
		respond @allowed "cookies are working"

		header set-cookie "valid={{ now | date '2006-01-02' }}; max-age=86400"
		respond "please reload to check cookies"
	}

}

5. Links to relevant resources:

Type here