diff --git a/cmk/plugins/collection/server_side_calls/httpv1.py b/cmk/plugins/collection/server_side_calls/httpv1.py index 000e5278db4..66d34c22823 100644 --- a/cmk/plugins/collection/server_side_calls/httpv1.py +++ b/cmk/plugins/collection/server_side_calls/httpv1.py @@ -352,7 +352,7 @@ def _common_args( args += ["-I", replace_macros(host.server_address, host_config.macros)] if (virtual_host := host.virtual_host(mode)) is not None: - args += ["-H", virtual_host] + args += ["-H", replace_macros(virtual_host, host_config.macros)] return args diff --git a/tests/unit/cmk/plugins/collection/server_side_calls/test_httpv1.py b/tests/unit/cmk/plugins/collection/server_side_calls/test_httpv1.py index 1bfdd8e1a58..0294620fb14 100644 --- a/tests/unit/cmk/plugins/collection/server_side_calls/test_httpv1.py +++ b/tests/unit/cmk/plugins/collection/server_side_calls/test_httpv1.py @@ -348,6 +348,31 @@ "virtual.host", ], ), + ( + { + "name": "irrelevant", + "mode": ("url", {}), + "host": { + "virthost": "$to.expand.virthost$", + "address": ("direct", "$to.expand.address$"), + }, + }, + HostConfig( + name="hostname", + ipv4_config=IPv4Config(address="1.2.3.4"), + macros={ + "$to.expand.virthost$": "expanded.virthost", + "$to.expand.address$": "expanded.address", + }, + ), + [ + "--sni", + "-I", + "expanded.address", + "-H", + "expanded.virthost", + ], + ), ( { "name": "irrelevant",