From 30372db4b3396f22ac5499363a068ffe166982d6 Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Fri, 9 Oct 2020 10:33:59 +0100 Subject: [PATCH 1/3] Use valid grpc header Signed-off-by: Michel Hollands --- pkg/util/extract_forwarded.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/util/extract_forwarded.go b/pkg/util/extract_forwarded.go index 79eca5723c4..aa0eaa2af25 100644 --- a/pkg/util/extract_forwarded.go +++ b/pkg/util/extract_forwarded.go @@ -7,7 +7,7 @@ import ( ) // ipAddressesKey is key for the GRPC metadata where the IP addresses are stored -const ipAddressesKey = "github.com/cortexproject/cortex/util/extract_forwarded/x-forwarded-for" +const ipAddressesKey = "x-forwarded-for-bin" // GetSourceIPsFromOutgoingCtx extracts the source field from the GRPC context func GetSourceIPsFromOutgoingCtx(ctx context.Context) string { From 7a6749fb4fc333f7235ce81651736fefabba7955 Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Fri, 9 Oct 2020 11:12:08 +0100 Subject: [PATCH 2/3] Rename grpc metadata key to be more unique and not binary Signed-off-by: Michel Hollands --- pkg/util/extract_forwarded.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/util/extract_forwarded.go b/pkg/util/extract_forwarded.go index aa0eaa2af25..9cacf3b3a4e 100644 --- a/pkg/util/extract_forwarded.go +++ b/pkg/util/extract_forwarded.go @@ -7,7 +7,7 @@ import ( ) // ipAddressesKey is key for the GRPC metadata where the IP addresses are stored -const ipAddressesKey = "x-forwarded-for-bin" +const ipAddressesKey = "extract-forwarded-x-forwarded-for" // GetSourceIPsFromOutgoingCtx extracts the source field from the GRPC context func GetSourceIPsFromOutgoingCtx(ctx context.Context) string { From 2bee4913ab8c29845c01cdd1bef80aff887dd6ca Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Fri, 9 Oct 2020 13:29:40 +0100 Subject: [PATCH 3/3] Update changelog Signed-off-by: Michel Hollands --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b29858e167..9d122ce3462 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,6 +83,7 @@ * [BUGFIX] Experimental Alertmanager API: Do not allow empty Alertmanager configurations or bad template filenames to be submitted through the configuration API. #3185 * [BUGFIX] Reduce failures to update heartbeat when using Consul. #3259 * [BUGFIX] When using ruler sharding, moving all user rule groups from ruler to a different one and then back could end up with some user groups not being evaluated at all. #3235 +* [BUGFIX] Use a valid grpc header when logging IP addresses. #3307 ## 1.4.0 / 2020-10-02