Skip to content

Commit

Permalink
add set response headers global option (pomerium#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
wasaga authored Apr 19, 2023
1 parent 6cb4f7d commit b354fe1
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
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

0 comments on commit b354fe1

Please sign in to comment.