Skip to content

Commit

Permalink
internal/contour: Add Support for custom headers on HTTPProxy level
Browse files Browse the repository at this point in the history
Introduces support for request and repsonse headers on http proxy level

Fixes: projectcontour#5576
Signed-off-by: Devesh Kumar <vrshu112@gmail.com>
  • Loading branch information
deveshk0 committed Jul 25, 2023
1 parent f6c112e commit 1d25edf
Show file tree
Hide file tree
Showing 11 changed files with 445 additions and 1 deletion.
8 changes: 8 additions & 0 deletions apis/projectcontour/v1/httpproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,14 @@ type VirtualHost struct {
// +optional
JWTProviders []JWTProvider `json:"jwtProviders,omitempty"`

// The policy for managing request headers during proxying.
// +optional
RequestHeadersPolicy *HeadersPolicy `json:"requestHeadersPolicy,omitempty"`
// The policy for managing response headers during proxying.
// Rewriting the 'Host' header is not supported.
// +optional
ResponseHeadersPolicy *HeadersPolicy `json:"responseHeadersPolicy,omitempty"`

// IPAllowFilterPolicy is a list of ipv4/6 filter rules for which matching
// requests should be allowed. All other requests will be denied.
// Only one of IPAllowFilterPolicy and IPDenyFilterPolicy can be defined.
Expand Down
10 changes: 10 additions & 0 deletions apis/projectcontour/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 67 additions & 0 deletions examples/contour/01-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7182,6 +7182,73 @@ spec:
- unit
type: object
type: object
requestHeadersPolicy:
description: The policy for managing request headers during proxying.
properties:
remove:
description: Remove specifies a list of HTTP header names
to remove.
items:
type: string
type: array
set:
description: Set specifies a list of HTTP header values that
will be set in the HTTP header. If the header does not exist
it will be added, otherwise it will be overwritten with
the new value.
items:
description: HeaderValue represents a header name/value
pair
properties:
name:
description: Name represents a key of a header
minLength: 1
type: string
value:
description: Value represents the value of a header
specified by a key
minLength: 1
type: string
required:
- name
- value
type: object
type: array
type: object
responseHeadersPolicy:
description: The policy for managing response headers during proxying.
Rewriting the 'Host' header is not supported.
properties:
remove:
description: Remove specifies a list of HTTP header names
to remove.
items:
type: string
type: array
set:
description: Set specifies a list of HTTP header values that
will be set in the HTTP header. If the header does not exist
it will be added, otherwise it will be overwritten with
the new value.
items:
description: HeaderValue represents a header name/value
pair
properties:
name:
description: Name represents a key of a header
minLength: 1
type: string
value:
description: Value represents the value of a header
specified by a key
minLength: 1
type: string
required:
- name
- value
type: object
type: array
type: object
tls:
description: If present the fields describes TLS properties of
the virtual host. The SNI names that will be matched on are
Expand Down
67 changes: 67 additions & 0 deletions examples/render/contour-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7395,6 +7395,73 @@ spec:
- unit
type: object
type: object
requestHeadersPolicy:
description: The policy for managing request headers during proxying.
properties:
remove:
description: Remove specifies a list of HTTP header names
to remove.
items:
type: string
type: array
set:
description: Set specifies a list of HTTP header values that
will be set in the HTTP header. If the header does not exist
it will be added, otherwise it will be overwritten with
the new value.
items:
description: HeaderValue represents a header name/value
pair
properties:
name:
description: Name represents a key of a header
minLength: 1
type: string
value:
description: Value represents the value of a header
specified by a key
minLength: 1
type: string
required:
- name
- value
type: object
type: array
type: object
responseHeadersPolicy:
description: The policy for managing response headers during proxying.
Rewriting the 'Host' header is not supported.
properties:
remove:
description: Remove specifies a list of HTTP header names
to remove.
items:
type: string
type: array
set:
description: Set specifies a list of HTTP header values that
will be set in the HTTP header. If the header does not exist
it will be added, otherwise it will be overwritten with
the new value.
items:
description: HeaderValue represents a header name/value
pair
properties:
name:
description: Name represents a key of a header
minLength: 1
type: string
value:
description: Value represents the value of a header
specified by a key
minLength: 1
type: string
required:
- name
- value
type: object
type: array
type: object
tls:
description: If present the fields describes TLS properties of
the virtual host. The SNI names that will be matched on are
Expand Down
67 changes: 67 additions & 0 deletions examples/render/contour-gateway-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7196,6 +7196,73 @@ spec:
- unit
type: object
type: object
requestHeadersPolicy:
description: The policy for managing request headers during proxying.
properties:
remove:
description: Remove specifies a list of HTTP header names
to remove.
items:
type: string
type: array
set:
description: Set specifies a list of HTTP header values that
will be set in the HTTP header. If the header does not exist
it will be added, otherwise it will be overwritten with
the new value.
items:
description: HeaderValue represents a header name/value
pair
properties:
name:
description: Name represents a key of a header
minLength: 1
type: string
value:
description: Value represents the value of a header
specified by a key
minLength: 1
type: string
required:
- name
- value
type: object
type: array
type: object
responseHeadersPolicy:
description: The policy for managing response headers during proxying.
Rewriting the 'Host' header is not supported.
properties:
remove:
description: Remove specifies a list of HTTP header names
to remove.
items:
type: string
type: array
set:
description: Set specifies a list of HTTP header values that
will be set in the HTTP header. If the header does not exist
it will be added, otherwise it will be overwritten with
the new value.
items:
description: HeaderValue represents a header name/value
pair
properties:
name:
description: Name represents a key of a header
minLength: 1
type: string
value:
description: Value represents the value of a header
specified by a key
minLength: 1
type: string
required:
- name
- value
type: object
type: array
type: object
tls:
description: If present the fields describes TLS properties of
the virtual host. The SNI names that will be matched on are
Expand Down
67 changes: 67 additions & 0 deletions examples/render/contour-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7401,6 +7401,73 @@ spec:
- unit
type: object
type: object
requestHeadersPolicy:
description: The policy for managing request headers during proxying.
properties:
remove:
description: Remove specifies a list of HTTP header names
to remove.
items:
type: string
type: array
set:
description: Set specifies a list of HTTP header values that
will be set in the HTTP header. If the header does not exist
it will be added, otherwise it will be overwritten with
the new value.
items:
description: HeaderValue represents a header name/value
pair
properties:
name:
description: Name represents a key of a header
minLength: 1
type: string
value:
description: Value represents the value of a header
specified by a key
minLength: 1
type: string
required:
- name
- value
type: object
type: array
type: object
responseHeadersPolicy:
description: The policy for managing response headers during proxying.
Rewriting the 'Host' header is not supported.
properties:
remove:
description: Remove specifies a list of HTTP header names
to remove.
items:
type: string
type: array
set:
description: Set specifies a list of HTTP header values that
will be set in the HTTP header. If the header does not exist
it will be added, otherwise it will be overwritten with
the new value.
items:
description: HeaderValue represents a header name/value
pair
properties:
name:
description: Name represents a key of a header
minLength: 1
type: string
value:
description: Value represents the value of a header
specified by a key
minLength: 1
type: string
required:
- name
- value
type: object
type: array
type: object
tls:
description: If present the fields describes TLS properties of
the virtual host. The SNI names that will be matched on are
Expand Down

0 comments on commit 1d25edf

Please sign in to comment.