From 9abd0714575ceacd548630c256e02b9ed191bede Mon Sep 17 00:00:00 2001 From: Jeavon Leopold Date: Wed, 29 Sep 2021 12:45:36 +0100 Subject: [PATCH] Fix for Excessive header checker when excluding Cloudflare --- .../HealthChecks/Checks/Security/ExcessiveHeadersCheck.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Core/HealthChecks/Checks/Security/ExcessiveHeadersCheck.cs b/src/Umbraco.Core/HealthChecks/Checks/Security/ExcessiveHeadersCheck.cs index cdd8a0493f04..34c76f2b6dc2 100644 --- a/src/Umbraco.Core/HealthChecks/Checks/Security/ExcessiveHeadersCheck.cs +++ b/src/Umbraco.Core/HealthChecks/Checks/Security/ExcessiveHeadersCheck.cs @@ -65,7 +65,7 @@ private async Task CheckForHeaders() var headersToCheckFor = new List {"Server", "X-Powered-By", "X-AspNet-Version", "X-AspNetMvc-Version" }; // Ignore if server header is present and it's set to cloudflare - if (allHeaders.InvariantContains("Server") && response.Headers.TryGetValues("Server", out var serverHeaders) && serverHeaders.ToString().InvariantEquals("cloudflare")) + if (allHeaders.InvariantContains("Server") && response.Headers.TryGetValues("Server", out var serverHeaders) && serverHeaders.FirstOrDefault().InvariantEquals("cloudflare")) { headersToCheckFor.Remove("Server"); }