How to reuse matchers between site blocks?

I want to reuse

  @nonLocal {
    not remote_ip 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8 127.0.0.1/32
  }

between my site blocks, but caddy tells me that

cannot define a matcher outside of a site bloc

So what is the recommended way to reuse matches?

I also initially wanted to define

  @local {
    remote_ip 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8 127.0.0.1/32
  }

and then define

@nonLocal {
  not @local
}

but this resulted in parser errors.

Snippets:

This is actually a work in progress, but it’s very tricky to get right.

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