Description
What steps did you take and what happened:
I found a potentially incorrect YAML example in the documentation at https://projectcontour.io/docs/main/config/request-rewriting/#manipulating-the-host-header
The current example shows requestHeaderPolicy
as a separate route element:
apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
name: static-host-header-rewrite-route
spec:
fqdn: local.projectcontour.io
routes:
- conditions:
- prefix: /
services:
- name: s1
port: 80
- requestHeaderPolicy:
set:
- name: host
value: foo.com
What did you expect to happen:
I believe requestHeaderPolicy should be part of the same route element, not a separate one. The correct YAML should be:
apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
name: static-host-header-rewrite-route
spec:
fqdn: local.projectcontour.io
routes:
- conditions:
- prefix: /
services:
- name: s1
port: 80
requestHeaderPolicy:
set:
- name: host
value: foo.com
Here's the diff showing the change:
routes:
- conditions:
- prefix: /
services:
- name: s1
port: 80
- - requestHeaderPolicy:
+ requestHeaderPolicy:
set:
- name: host
value: foo.com
The current example would likely not work as intended because it shows requestHeaderPolicy as a separate route element without any conditions or services. While this might be valid YAML syntax, it would not achieve the expected header rewriting behavior.
Anything else you would like to add:
- This documentation change was introduced in Allow dynamic header rewrite for
host
header on HTTPProxy routes. #5678 - This example exists in the documentation for versions 1.27, 1.28, 1.29, and 1.30
Could you please confirm if this is indeed a documentation error? If my understanding is correct, the current example might be misleading for users.
Environment:
N/A (Documentation issue)