Note: I’m ignoring the template, because it’s geared towards problems and I have more of a general question.
I am trying to figure out how to pare down redundant config declarations. I am wondering if that can be done by using wildcard addresses. However, the only mention of wildcards in the docs is for TLS. So, I am looking for confirmation whether this (below) is or is not possible.
Question: Given the configuration below, will the address ‘sub.example.com’ have logging and compression?
In your example, sub.example.com will NOT inherit configuration from *.example.com.
If you want to reuse code between blocks you’ll need to import the snippets into each block.
An alternative would be to simply not define a separate sub.example.com and instead put it under your *.example.com block with a host matcher:
*.example.com {
# These execute for all requests
import logs
import compress
@foo host foo.example.com
handle @foo {
# Only executes for foo.example.com
respond "I'm foo"
}
@bar host bar.example.com
handle @bar {
# Only executes for bar.example.com
respond "I'm bar"
}
handle {
# Only executes if none of the others did
# (handle blocks are mutually exclusive)
respond "I'm the default handler"
}
}