Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Front Door - Origin Header - Case Sensitivity #1082

Closed
kek-Sec opened this issue Jul 4, 2024 · 4 comments
Closed

Azure Front Door - Origin Header - Case Sensitivity #1082

kek-Sec opened this issue Jul 4, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@kek-Sec
Copy link
Contributor

kek-Sec commented Jul 4, 2024

Report

When the origin-header is for example: foo.Bar.com , instead of foo.bar.com in Azure Front Door (probably any other CDN aswell) you get the following exception:

2024-07-04T08:54:28Z    ERROR   LoggingMiddleware.RoutingMiddleware.StaticHandler       Not Found       {"routingKey": "//foo.Bar.com", "namespacedNameError": "PANIC=value method k8s.io/apimachinery/pkg/types.NamespacedName.MarshalLog called using nil *NamespacedName pointer", "stream": "<nil>"}
github.com/kedacore/http-add-on/interceptor/handler.(*Static).ServeHTTP
        github.com/kedacore/http-add-on/interceptor/handler/static.go:36
github.com/kedacore/http-add-on/interceptor/middleware.(*Routing).ServeHTTP
        github.com/kedacore/http-add-on/interceptor/middleware/routing.go:49
github.com/kedacore/http-add-on/interceptor/middleware.(*Logging).ServeHTTP
        github.com/kedacore/http-add-on/interceptor/middleware/logging.go:42
github.com/kedacore/http-add-on/interceptor/middleware.(*Metrics).ServeHTTP
        github.com/kedacore/http-add-on/interceptor/middleware/metrics.go:24
net/http.serverHandler.ServeHTTP
        net/http/server.go:3137
net/http.(*conn).serve
        net/http/server.go:2039

Expected Behavior

Request should be routed in a case insensitive way since domains are not case sensitive

Actual Behavior

Request route is case sensitive

Steps to Reproduce the Problem

  1. Create an nginx ingress with httpscaleobject for foo.bar.com
  2. Attempt to access the domain via foo.Bar.com (or set origin headers to foo.Bar.com)
  3. 404 not found with error in proxy

Logs from KEDA HTTP operator

2024-07-04T08:32:31Z    ERROR   LoggingMiddleware.RoutingMiddleware.StaticHandler       Not Found       {"routingKey": "//foo.Bar.com/health/", "namespacedNameError": "PANIC=value method k8s.io/apimachinery/pkg/types.NamespacedName.MarshalLog called using nil *NamespacedName pointer", "stream": "<nil>"}
github.com/kedacore/http-add-on/interceptor/handler.(*Static).ServeHTTP
        github.com/kedacore/http-add-on/interceptor/handler/static.go:36
github.com/kedacore/http-add-on/interceptor/middleware.(*Routing).ServeHTTP
        github.com/kedacore/http-add-on/interceptor/middleware/routing.go:49
github.com/kedacore/http-add-on/interceptor/middleware.(*Logging).ServeHTTP
        github.com/kedacore/http-add-on/interceptor/middleware/logging.go:42
github.com/kedacore/http-add-on/interceptor/middleware.(*Metrics).ServeHTTP
        github.com/kedacore/http-add-on/interceptor/middleware/metrics.go:24
net/http.serverHandler.ServeHTTP
        net/http/server.go:3137
net/http.(*conn).serve
        net/http/server.go:2039

HTTP Add-on Version

0.8.0

Kubernetes Version

1.29

Platform

Microsoft Azure

Anything else?

No response

@kek-Sec kek-Sec added the bug Something isn't working label Jul 4, 2024
@JorTurFer
Copy link
Member

Hello,
The headers keys are case-insensitive by RFC, but the values must be treated as case-sensitive, so the header should be right. Are you setting the header origin or host? The interceptor routes based on host header (not origin), so if you don't provide host, the error is normal

@kek-Sec
Copy link
Contributor Author

kek-Sec commented Sep 5, 2024

@JorTurFer Thanks for getting back to me , this seemed to work only after changing the value of: Origin host header on the azure portal , this seems to also populate the host header. I think this can be closed since its the expected behavior. Let me know if you'd like me to document the entire FrontDoor <-> Aks setup for the scaler for future reference.

@JorTurFer
Copy link
Member

JorTurFer commented Sep 5, 2024

Let me know if you'd like me to document the entire FrontDoor <-> Aks setup for the scaler for future reference

If you can improve the docs adding this example would be nice! ❤️ I think that for the moment, we can write it down in this page -> https://github.com/kedacore/http-add-on/blob/main/docs/integrations.md

we want to refactor the docs at any point, but for the moment it seems as the best place

And thanks a lot!

@kek-Sec
Copy link
Contributor Author

kek-Sec commented Sep 5, 2024

@JorTurFer - Pull request created Have a nice day!

@kek-Sec kek-Sec closed this as completed Sep 5, 2024
@github-project-automation github-project-automation bot moved this from To Triage to Done in Roadmap - KEDA HTTP Add-On Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants