Error during parsing: unrecognized response matcher expression

1. Caddy version (caddy version):

v2.4.5 h1:P1mRs6V2cMcagSPn+NWpD+OEYUYLIf6ecOa48cFGeUg=

2. How I run Caddy:


a. System environment:

Arch Linux, executing the binary

b. Command:

./caddy run -config Caddyfile

c. Service/unit/compose file:


d. My complete Caddyfile or JSON config:

:8081 {
    tls internal

    reverse_proxy {
        header_up Host {upstream_hostport}
        header_up X-Forwarded-Host {host}
        header_up -Accept-Encoding
        @status_code {
          status 200
          expression `{http.reverse_proxy.header.server} == "Caddy"`
        redir @status_code


3. The problem I’m having:

I’m getting an error

4. Error messages and/or full log output:

2021/10/03 01:39:25.105 INFO    using provided configuration    {"config_file": "Caddyfile", "config_adapter": ""}
run: adapting config using caddyfile: parsing caddyfile tokens for 'reverse_proxy': Caddyfile:11 - Error during parsing: unrecognized response matcher expression

5. What I already tried:

None, as I cannot find any info about response matcher. Only request matcher is available in docs.

6. Links to relevant resources:

expression cannot be used to match responses. The only ones currently available are status and header, as described in the docs:

Also, you need to define a handle_response block, under which you can define handler directives (like redir).

That said, handle_response currently has a bug that prevents it from working with any requests that have a non-empty response body. So it’s not currently possible to do what you’re trying to do, unfortunately.

Thank you :slight_smile:

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.