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

[ADR] Support setting up custom headers in APIRule requests and responses #894

Open
Ressetkk opened this issue Feb 22, 2024 · 0 comments
Open
Labels

Comments

@Ressetkk
Copy link
Collaborator

Support setting up custom headers in APIRule

Status

Proposed

Context

Users request feature for APIRule to support setting up custom headers in the CR based on the VirtualService Headers section. Users use application configuration where upstream connectivity requires some values to be passed as headers in a request. See discussion in #808 (comment)

Decision

  1. APIRule definition is extended with headers section.
  2. Headers section lets user manipulate headers on request and response level.
  3. Headers section lets user set additional labels that will be present in request or response.
  4. If user-provided key in APIRule is already present in the request/response, value is overridden with user-provided data.

APIRule extension

kind: APIRule
metadata:
    name: rule
    namespace: default
spec:
    gateway: kyma-system/kyma-gateway
    headers:
        request:
            set:
                X-CLIENT-SSL-CN: "%DOWNSTREAM_PEER_SUBJECT%"
                X-CLIENT-SSL-SAN: "%DOWNSTREAM_PEER_URI_SAN%"
                X-CLIENT-SSL-ISSUER: "%DOWNSTREAM_PEER_ISSUER%"
(...)

The APIRuleSpec struct is extended with a variable of type HeadersConfig:

type APIRuleSpec {
    // Headers contains information about header manipulation in APIRule
    Headers HeadersConfig
}

type HeadersConfig struct {
    // Request defines header manipulation options for all requests passing through an APIRule
    Request HeaderOptions
    // Response defines header manipulation options for all responses passing through an APIRule
    Response HeaderOptions
}

type HeaderOptions {
    // Set contains key/value pair map containing headers that are set in APIRule
    Set map[string]string
}

Consequences

  • User is allowed to set up custom headers in requests and responses that go through APIRule and its managed resources.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant