#13131·traefik

Knative DomainMapping returns 404 may because rewriteHost is not implemented in Knative provider

Author: AbirdcflyCreated May 9, 2026Updated Sep 23, 2026
Labelskind/enhancementcontributor/wantedarea/provider/k8s/knative

Welcome!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've searched similar issues on the Traefik community forum and didn't find any.

What did you do?

Using Traefik as the Knative networking layer (networking.knative.dev/ingress.class: traefik.ingress.networking.knative.dev).

  1. Created a Knative Service hello-world in namespace knative-serving — accessing it via Host: hello-world.knative-serving.example.com through Traefik works correctly.
  2. Created a DomainMapping to map custom.another-domain.com to the same ksvc:
yaml
apiVersion: serving.knative.dev/v1beta1
kind: DomainMapping
metadata:
  name: custom.another-domain.com
  namespace: knative-serving
spec:
  ref:
    name: hello-world
    kind: Service
    apiVersion: serving.knative.dev/v1
  1. The DomainMapping is Ready, and the corresponding Knative Ingress (king) is created with the correct ingress class annotation. The king spec contains:
yaml
  spec:
    rules:
    - hosts:
      - custom.another-domain.com
      http:
        paths:
        - rewriteHost: hello-world.knative-serving.svc.cluster.local
          splits:
          - appendHeaders:
              K-Original-Host: custom.another-domain.com
            percent: 100
            serviceName: hello-world
            serviceNamespace: knative-serving
            servicePort: 80
  1. Sent a request: curl -H "Host: custom.another-domain.com" http://<traefik-ip>:80/

What did you see instead?

Traefik returns 404 immediately.

Root cause: The Knative provider in pkg/provider/kubernetes/knative/kubernetes.go:298 has a TODO comment and does not implement rewriteHost:

go
  // TODO: support rewrite host
  for pi, path := range rule.HTTP.Paths {

The path.RewriteHost field is completely ignored. As a result, the request is forwarded to the backend with Host: custom.another-domain.com instead of Host: hello-world.knative-serving.svc.cluster.local. The Knative ctivator/Queue-proxy cannot route the request and returns 404.

Additionally, split-level appendHeaders (like K-Original-Host) are only passed to the WRR service config for routing discrimination, but are not added as request headers via a middleware — so the backend also loses the original host information.

What version of Traefik are you using?

Version: 3.6.12 Codename: ramequin Go version: go1.25.8 Built: 2026-03-26T10:0053Z OS/Arch: linux/amd64

What is your environment & configuration?

yaml
# (paste your configuration here)

Add more configuration information here.

If applicable, please paste the log output in DEBUG level

No response