Skip to content

HTTPScaledObject with empty/omitted hosts fails to match requests with Host headers #1320

@efernandes-dev-ops

Description

@efernandes-dev-ops

Report

When an HTTPScaledObject is configured without specifying hosts (either omitted entirely or set to an empty array), it fails to route HTTP requests that contain a Host header. This breaks the expected "catch-all" behavior documented in the codebase.

Expected Behavior

According to the API documentation and code comments, when spec.hosts is omitted or empty, the HTTPScaledObject should act as a catch-all and route all incoming HTTP requests regardless of their Host header value.

# HTTPScaledObject without hosts specified
apiVersion: http.keda.sh/v1alpha1
kind: HTTPScaledObject
metadata:
  name: my-app
spec:
  # hosts: []  # omitted or empty - should match ALL hosts
  scaleTargetRef:
    service: my-app
    port: 8080

Should route successfully:
✅ curl http://interceptor:8080/ (no Host header)
✅ curl -H "Host: example.com" http://interceptor:8080/ (any Host header)
✅ curl -H "Host: customer1.com" http://interceptor:8080/ (any Host header)

Actual Behavior

The current implementation only routes requests that have no Host header or an empty Host header. Any request with a populated Host header returns 404 Not Found.
Actual routing behavior:

❌ curl http://interceptor:8080/ (no Host header) → 404 Not Found
❌ curl -H "Host: example.com" http://interceptor:8080/ → 404 Not Found
❌ curl -H "Host: anything.com" http://interceptor:8080/ → 404 Not Found

Steps to Reproduce the Problem

  1. Deploy KEDA HTTP Add-on (any recent version)
  2. Create a test service
  3. Create HTTPScaledObject without hosts
  4. Test the routing

Logs from KEDA HTTP operator

example

HTTP Add-on Version

0.10.0

Kubernetes Version

1.32

Platform

Amazon Web Services

Anything else?

I have tried adding a wildcard '*' to hosts and that doesnt work

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions