Skip to content

Commit dade425

Browse files
authored
chore: improve api docs for http10.useDefaultHost (#7435)
* imporove api docs for useDefaultHost Signed-off-by: Huabing Zhao <[email protected]>
1 parent aa2f693 commit dade425

File tree

6 files changed

+62
-26
lines changed

6 files changed

+62
-26
lines changed

api/v1alpha1/clienttrafficpolicy_types.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,19 @@ type HTTP1Settings struct {
357357

358358
// HTTP10Settings provides HTTP/1.0 configuration on the listener.
359359
type HTTP10Settings struct {
360-
// UseDefaultHost defines if the HTTP/1.0 request is missing the Host header,
361-
// then the hostname associated with the listener should be injected into the
362-
// request.
363-
// If this is not set and an HTTP/1.0 request arrives without a host, then
364-
// it will be rejected.
360+
// UseDefaultHost specifies whether a default Host header should be injected
361+
// into HTTP/1.0 requests that do not include one.
362+
//
363+
// When set to true, Envoy Gateway injects the hostname associated with the
364+
// listener or route into the request, in the following order:
365+
//
366+
// 1. If the targeted listener has a non-wildcard hostname, use that hostname.
367+
// 2. If there is exactly one HTTPRoute with a non-wildcard hostname under
368+
// the targeted listener, use that hostname.
369+
//
370+
// Note: Setting this field to true without a non-wildcard hostname makes the
371+
// ClientTrafficPolicy invalid.
372+
//
365373
// +optional
366374
UseDefaultHost *bool `json:"useDefaultHost,omitempty"`
367375
}

charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_clienttrafficpolicies.yaml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -604,11 +604,18 @@ spec:
604604
properties:
605605
useDefaultHost:
606606
description: |-
607-
UseDefaultHost defines if the HTTP/1.0 request is missing the Host header,
608-
then the hostname associated with the listener should be injected into the
609-
request.
610-
If this is not set and an HTTP/1.0 request arrives without a host, then
611-
it will be rejected.
607+
UseDefaultHost specifies whether a default Host header should be injected
608+
into HTTP/1.0 requests that do not include one.
609+
610+
When set to true, Envoy Gateway injects the hostname associated with the
611+
listener or route into the request, in the following order:
612+
613+
1. If the targeted listener has a non-wildcard hostname, use that hostname.
614+
2. If there is exactly one HTTPRoute with a non-wildcard hostname under
615+
the targeted listener, use that hostname.
616+
617+
Note: Setting this field to true without a non-wildcard hostname makes the
618+
ClientTrafficPolicy invalid.
612619
type: boolean
613620
type: object
614621
preserveHeaderCase:

charts/gateway-helm/crds/generated/gateway.envoyproxy.io_clienttrafficpolicies.yaml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -603,11 +603,18 @@ spec:
603603
properties:
604604
useDefaultHost:
605605
description: |-
606-
UseDefaultHost defines if the HTTP/1.0 request is missing the Host header,
607-
then the hostname associated with the listener should be injected into the
608-
request.
609-
If this is not set and an HTTP/1.0 request arrives without a host, then
610-
it will be rejected.
606+
UseDefaultHost specifies whether a default Host header should be injected
607+
into HTTP/1.0 requests that do not include one.
608+
609+
When set to true, Envoy Gateway injects the hostname associated with the
610+
listener or route into the request, in the following order:
611+
612+
1. If the targeted listener has a non-wildcard hostname, use that hostname.
613+
2. If there is exactly one HTTPRoute with a non-wildcard hostname under
614+
the targeted listener, use that hostname.
615+
616+
Note: Setting this field to true without a non-wildcard hostname makes the
617+
ClientTrafficPolicy invalid.
611618
type: boolean
612619
type: object
613620
preserveHeaderCase:

site/content/en/latest/api/extension_types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2215,7 +2215,7 @@ _Appears in:_
22152215

22162216
| Field | Type | Required | Default | Description |
22172217
| --- | --- | --- | --- | --- |
2218-
| `useDefaultHost` | _boolean_ | false | | UseDefaultHost defines if the HTTP/1.0 request is missing the Host header,<br />then the hostname associated with the listener should be injected into the<br />request.<br />If this is not set and an HTTP/1.0 request arrives without a host, then<br />it will be rejected. |
2218+
| `useDefaultHost` | _boolean_ | false | | UseDefaultHost specifies whether a default Host header should be injected<br />into HTTP/1.0 requests that do not include one.<br />When set to true, Envoy Gateway injects the hostname associated with the<br />listener or route into the request, in the following order:<br /> 1. If the targeted listener has a non-wildcard hostname, use that hostname.<br /> 2. If there is exactly one HTTPRoute with a non-wildcard hostname under<br /> the targeted listener, use that hostname.<br /> Note: Setting this field to true without a non-wildcard hostname makes the<br />ClientTrafficPolicy invalid. |
22192219

22202220

22212221
#### HTTP1Settings

test/helm/gateway-crds-helm/all.out.yaml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24505,11 +24505,18 @@ spec:
2450524505
properties:
2450624506
useDefaultHost:
2450724507
description: |-
24508-
UseDefaultHost defines if the HTTP/1.0 request is missing the Host header,
24509-
then the hostname associated with the listener should be injected into the
24510-
request.
24511-
If this is not set and an HTTP/1.0 request arrives without a host, then
24512-
it will be rejected.
24508+
UseDefaultHost specifies whether a default Host header should be injected
24509+
into HTTP/1.0 requests that do not include one.
24510+
24511+
When set to true, Envoy Gateway injects the hostname associated with the
24512+
listener or route into the request, in the following order:
24513+
24514+
1. If the targeted listener has a non-wildcard hostname, use that hostname.
24515+
2. If there is exactly one HTTPRoute with a non-wildcard hostname under
24516+
the targeted listener, use that hostname.
24517+
24518+
Note: Setting this field to true without a non-wildcard hostname makes the
24519+
ClientTrafficPolicy invalid.
2451324520
type: boolean
2451424521
type: object
2451524522
preserveHeaderCase:

test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3849,11 +3849,18 @@ spec:
38493849
properties:
38503850
useDefaultHost:
38513851
description: |-
3852-
UseDefaultHost defines if the HTTP/1.0 request is missing the Host header,
3853-
then the hostname associated with the listener should be injected into the
3854-
request.
3855-
If this is not set and an HTTP/1.0 request arrives without a host, then
3856-
it will be rejected.
3852+
UseDefaultHost specifies whether a default Host header should be injected
3853+
into HTTP/1.0 requests that do not include one.
3854+
3855+
When set to true, Envoy Gateway injects the hostname associated with the
3856+
listener or route into the request, in the following order:
3857+
3858+
1. If the targeted listener has a non-wildcard hostname, use that hostname.
3859+
2. If there is exactly one HTTPRoute with a non-wildcard hostname under
3860+
the targeted listener, use that hostname.
3861+
3862+
Note: Setting this field to true without a non-wildcard hostname makes the
3863+
ClientTrafficPolicy invalid.
38573864
type: boolean
38583865
type: object
38593866
preserveHeaderCase:

0 commit comments

Comments
 (0)