-
Notifications
You must be signed in to change notification settings - Fork 690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to disable Envoy adding server headers to responses #4906
Merged
skriss
merged 17 commits into
projectcontour:main
from
vishal-chdhry:disable-envoy-adding-server
Jan 23, 2023
Merged
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
487bd4c
WIP
vishal-chdhry 7613b45
NIT
vishal-chdhry d779ee5
NIT
vishal-chdhry 73fc2eb
Merge branch 'main' into disable-envoy-adding-server
vishal-chdhry 5e3b212
changed server header transformation to enum
vishal-chdhry 8b8aa12
wrote serverHeaderTransformationType
vishal-chdhry 0af9fc9
added serverHeaderTransformation to config file
vishal-chdhry b12cce2
added changelog
vishal-chdhry 7022e23
changed serverheader transform type to string
vishal-chdhry 00ec3ec
NIT
vishal-chdhry 965212c
tests
vishal-chdhry 6635ef4
test changes
vishal-chdhry 48f434e
Merge branch 'main' of https://github.com/projectcontour/contour into…
vishal-chdhry 48b5224
make generate
vishal-chdhry f74bb55
fix unit test failures
skriss b7cf999
lowercase field values
skriss 147e890
docs updates
skriss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -336,6 +336,18 @@ type EnvoyListenerConfig struct { | |||||
// +optional | ||||||
DisableMergeSlashes *bool `json:"disableMergeSlashes,omitempty"` | ||||||
|
||||||
// Defines the action to be applied to the Server header on the response path | ||||||
// When configured as overwrite, overwrites any Server header with the contents of server_name. | ||||||
// When configured as append_if_absent, If no Server header is present, append Server server_name If a Server header is present, pass it through. | ||||||
// When configured as pass_through, pPass through the value of the server header, and do not append a header if none is present. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
// | ||||||
// Values: `overwrite` (default), `append_if_absent`, `pass_through` | ||||||
// | ||||||
// Other values will produce an error. | ||||||
// Contour's default is overwrite. | ||||||
// +optional | ||||||
ServerHeaderTransformation ServerHeaderTransformationType `json:"serverHeaderTransformation,omitempty"` | ||||||
|
||||||
// ConnectionBalancer. If the value is exact, the listener will use the exact connection balancer | ||||||
// See https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/listener.proto#envoy-api-msg-listener-connectionbalanceconfig | ||||||
// for more information. | ||||||
|
@@ -532,6 +544,21 @@ const ( | |||||
AllClusterDNSFamily ClusterDNSFamilyType = "all" | ||||||
) | ||||||
|
||||||
// ServerHeaderTransformation defines the action to be applied to the Server header on the response path | ||||||
type ServerHeaderTransformationType string | ||||||
|
||||||
const ( | ||||||
// Overwrite any Server header with the contents of server_name. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe similar here with |
||||||
// This is the default value | ||||||
OverwriteServerHeader ServerHeaderTransformationType = "overwrite" | ||||||
// If no Server header is present, append Server server_name | ||||||
// If a Server header is present, pass it through. | ||||||
AppendIfAbsentServerHeader ServerHeaderTransformationType = "append_if_absent" | ||||||
// Pass through the value of the server header, and do not append a header | ||||||
// if none is present. | ||||||
PassThroughServerHeader ServerHeaderTransformationType = "pass_through" | ||||||
) | ||||||
|
||||||
// ClusterParameters holds various configurable cluster values. | ||||||
type ClusterParameters struct { | ||||||
// DNSLookupFamily defines how external names are looked up | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## Enable configuring Server header transformation | ||
|
||
Envoy's treatment of the Server header on responses can now be configured in the Contour config file or ContourConfiguration CRD. | ||
When configured as `overwrite`, Envoy overwrites any Server header with "envoy". | ||
When configured as `append_if_absent`, if a Server header is present, Envoy will pass it through, otherwise, it will set it to "envoy". | ||
When configured as `pass_through`, Envoy passes through the value of the Server header and does not append a header if none is present. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this section probably replace
server_name
withenvoy
? since we don't make it configurable (i think this was copied from the envoy docs)