nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: kedacore/http-add-on
Pull request #1199 (2024-12-03 16:43:59)

add support for AWS ELB healthcheck probe #1198
Add support for AWS ELB healthcheck probe #1198

### Checklist

- [x] Commits are signed with Developer Certificate of Origin (DCO)
- [x] Changelog has been updated and is aligned with our [changelog requirements](https://github.com/kedacore/keda/blob/main/CONTRIBUTING.md#Changelog)
- [x] Any necessary documentation is added, such as:
  - [`README.md`](/README.md)
  - [The `docs/` directory](./docs)
  - [The docs repo](https://github.com/kedacore/keda-docs)
- [x] Test added
Fixes #



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0659545..784230c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,6 +27,8 @@ This changelog keeps track of work items that have been completed and are ready
 - **General**: Support setting multiple TLS certs for different domains on the interceptor proxy ([#1116](https://github.com/kedacore/http-add-on/issues/1116))
 - **General**: TODO ([#TODO](https://github.com/kedacore/http-add-on/issues/TODO))
 
+- **Interceptor**: Add support for for AWS ELB healthcheck probe ([#1198](https://github.com/kedacore/http-add-on/issues/1198))
+
 ### Improvements
 
 - **General**: TODO ([#TODO](https://github.com/kedacore/http-add-on/issues/TODO))
diff --git a/interceptor/middleware/routing.go b/interceptor/middleware/routing.go
index 69c6bcd..7f3ef81 100644
--- a/interceptor/middleware/routing.go
+++ b/interceptor/middleware/routing.go
@@ -17,6 +17,7 @@ import (
 var (
 	kubernetesProbeUserAgent = regexp.MustCompile(`(^|\s)kube-probe/`)
 	googleHCUserAgent        = regexp.MustCompile(`(^|\s)GoogleHC/`)
+	awsELBserAgent           = regexp.MustCompile(`(^|\s)ELB-HealthChecker/`)
 )
 
 type Routing struct {
@@ -112,5 +113,5 @@ func (rm *Routing) streamFromHTTPSO(ctx context.Context, httpso *httpv1alpha1.HT
 func (rm *Routing) isProbe(r *http.Request) bool {
 	ua := r.UserAgent()
 
-	return kubernetesProbeUserAgent.Match([]byte(ua)) || googleHCUserAgent.Match([]byte(ua))
+	return kubernetesProbeUserAgent.Match([]byte(ua)) || googleHCUserAgent.Match([]byte(ua)) || awsELBserAgent.Match([]byte(ua))
 }


Test patch:
diff --git a/interceptor/middleware/routing_test.go b/interceptor/middleware/routing_test.go
index b57f232..6f3ae4f 100644
--- a/interceptor/middleware/routing_test.go
+++ b/interceptor/middleware/routing_test.go
@@ -304,7 +304,19 @@ var _ = Describe("RoutingMiddleware", func() {
 			Expect(b).To(BeTrue())
 		})
 
-		It("returns false if the request is not from kube-probe or GoogleHC", func() {
+		It("returns true if the request is from AWS ELB", func() {
+			const (
+				uaVal = "Go-http-client/1.1 ELB-HealthChecker/2.0 (linux/amd64) kubernetes/4c94112"
+			)
+
+			r.Header.Set(uaKey, uaVal)
+
+			var rm Routing
+			b := rm.isProbe(r)
+			Expect(b).To(BeTrue())
+		})
+
+		It("returns false if the request is not from kube-probe or GoogleHC or ELB-HealthChecker", func() {
 			const (
 				uaVal = "Go-http-client/1.1 kubectl/v1.27.1 (linux/amd64) kubernetes/4c94112"
 			)