Skip to content
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

add set response headers global option #599

Merged
merged 1 commit into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apis/ingress/v1/pomerium_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ type PomeriumSpec struct {
//
// +optional
JWTClaimHeaders map[string]string `json:"jwtClaimHeaders,omitempty"`

// SetRequestHeaders sets HTTP headers on the request before sending it to the upstream service.
// +optional
// See <a href="https://www.pomerium.com/docs/reference/#set-request-headers">Set Request Headers</a>
SetResponseHeaders map[string]string `json:"setResponseHeaders,omitempty"`
}

// ResourceStatus represents the outcome of the latest attempt to reconcile
Expand Down
7 changes: 7 additions & 0 deletions apis/ingress/v1/zz_generated.deepcopy.go

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

7 changes: 7 additions & 0 deletions config/crd/bases/ingress.pomerium.io_pomerium.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ spec:
format: namespace/name
minLength: 1
type: string
setResponseHeaders:
additionalProperties:
type: string
description: SetRequestHeaders sets HTTP headers on the request before
sending it to the upstream service. See <a href="https://www.pomerium.com/docs/reference/#set-request-headers">Set
Request Headers</a>
type: object
storage:
description: Storage defines persistent storage for sessions and other
data. See <a href="https://www.pomerium.com/docs/topics/data-storage">Storage</a>
Expand Down
7 changes: 7 additions & 0 deletions deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ spec:
format: namespace/name
minLength: 1
type: string
setResponseHeaders:
additionalProperties:
type: string
description: SetRequestHeaders sets HTTP headers on the request before
sending it to the upstream service. See <a href="https://www.pomerium.com/docs/reference/#set-request-headers">Set
Request Headers</a>
type: object
storage:
description: Storage defines persistent storage for sessions and other
data. See <a href="https://www.pomerium.com/docs/topics/data-storage">Storage</a>
Expand Down
6 changes: 6 additions & 0 deletions pomerium/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func applyConfig(ctx context.Context, p *pb.Config, c *model.Config) error {
{"cookie", applyCookie},
{"warnings", checkForWarnings},
{"jwt claim headers", applyJWTClaimHeaders},
{"set response headers", applySetResponseHeaders},
}
if c.Spec.IdentityProvider != nil {
opts = append(opts, []applyOpt{
Expand Down Expand Up @@ -75,6 +76,11 @@ func applyJWTClaimHeaders(_ context.Context, p *pb.Config, c *model.Config) erro
return nil
}

func applySetResponseHeaders(_ context.Context, p *pb.Config, c *model.Config) error {
p.Settings.SetResponseHeaders = c.Spec.SetResponseHeaders
return nil
}

func applyCookie(_ context.Context, p *pb.Config, c *model.Config) error {
if c.Spec.Cookie == nil {
return nil
Expand Down