diff options
author | Frederik Ring <frederik.ring@gmail.com> | 2021-08-02 22:15:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-02 14:15:27 -0600 |
commit | 569ecdbd02a3bdf8589f785cca022240973dea4d (patch) | |
tree | c86354c75c0c8b608ee7f06a345ae968a21d405f /caddytest | |
parent | c131339c5cda3a541223fde4a714aab55de13b9a (diff) |
httpcaddyfile: Ensure hosts to skip for logs can always be collected (#4258)
* httpcaddyfile: ensure hosts to skip can always be collected
Previously, some hosts that should be skipped in logging would
be missed as the current logic would only collect them after
encountering the first server that would log. This change makes sure
the ServerLogConfig is initialized before iterating over the server
blocks.
* httpcaddyfile: add test case for skip hosts behavior
Diffstat (limited to 'caddytest')
-rw-r--r-- | caddytest/integration/caddyfile_adapt/log_skip_hosts.txt | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/caddytest/integration/caddyfile_adapt/log_skip_hosts.txt b/caddytest/integration/caddyfile_adapt/log_skip_hosts.txt new file mode 100644 index 0000000..6fbd85a --- /dev/null +++ b/caddytest/integration/caddyfile_adapt/log_skip_hosts.txt @@ -0,0 +1,75 @@ +one.example.com { + log +} + +two.example.com { +} + +three.example.com { +} + +example.com { +} +---------- +{ + "apps": { + "http": { + "servers": { + "srv0": { + "listen": [ + ":443" + ], + "routes": [ + { + "match": [ + { + "host": [ + "three.example.com" + ] + } + ], + "terminal": true + }, + { + "match": [ + { + "host": [ + "one.example.com" + ] + } + ], + "terminal": true + }, + { + "match": [ + { + "host": [ + "two.example.com" + ] + } + ], + "terminal": true + }, + { + "match": [ + { + "host": [ + "example.com" + ] + } + ], + "terminal": true + } + ], + "logs": { + "skip_hosts": [ + "three.example.com", + "two.example.com", + "example.com" + ] + } + } + } + } + } +} |