Knative DomainMapping returns 404 may because rewriteHost is not implemented in Knative provider
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).
- Created a Knative Service
hello-worldin namespace knative-serving — accessing it viaHost: hello-world.knative-serving.example.comthrough Traefik works correctly. - Created a
DomainMappingto mapcustom.another-domain.comto the same ksvc:
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- The DomainMapping is Ready, and the corresponding Knative Ingress (king) is created with the correct ingress class annotation. The king spec contains:
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- 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:
// 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?
# (paste your configuration here)Add more configuration information here.
If applicable, please paste the log output in DEBUG level
No response
Source: traefik/traefik