From 9bb62a8eb96e6243dbf292db04e01f0436408243 Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 17 Feb 2024 17:58:22 +0530 Subject: [PATCH] Failover.CNAME: Fixed issue in GetAnswers() to select only A/AAAA type for health check monitoring. --- Apps/FailoverApp/CNAME.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Apps/FailoverApp/CNAME.cs b/Apps/FailoverApp/CNAME.cs index fb1e7513..3fa17a01 100644 --- a/Apps/FailoverApp/CNAME.cs +++ b/Apps/FailoverApp/CNAME.cs @@ -58,7 +58,14 @@ namespace Failover private DnsResourceRecord[] GetAnswers(string domain, DnsQuestionRecord question, string zoneName, uint appRecordTtl, string healthCheck, Uri healthCheckUrl) { - HealthCheckResponse response = _healthService.QueryStatus(domain, question.Type, healthCheck, healthCheckUrl, true); + DnsResourceRecordType healthCheckRecordType; + + if (question.Type == DnsResourceRecordType.AAAA) + healthCheckRecordType = DnsResourceRecordType.AAAA; + else + healthCheckRecordType = DnsResourceRecordType.A; + + HealthCheckResponse response = _healthService.QueryStatus(domain, healthCheckRecordType, healthCheck, healthCheckUrl, true); switch (response.Status) { case HealthStatus.Unknown: