Skip to content

Rewrite Rule Set issue using responseHeaderConfigurations for Set-Cookie #1730

@DavidRobson

Description

@DavidRobson

Is your feature request related to a problem? Please describe.
Currently this feature only has three fields: actionType, headerName, and headerValue

So if I try to implement a rule as documented Setting HTTPOnly or Secure flag for Session Affinity cookie

apiVersion: appgw.ingress.azure.io/v1beta1
kind: AzureApplicationGatewayRewrite
metadata:
  name: example-rewrite-rule
  namespace: default
spec:
  rewriteRules:
  - actions:
      responseHeaderConfigurations:
      - actionType: set
        headerName: Set-Cookie
        headerValue: '{http_resp_Set-Cookie_1}; Secure'
    conditions:
    - ignoreCase: true
      negate: false
      pattern: (ApplicationGatewayAffinity=.*)
      variable: http_resp_Set-Cookie
    name: affinityCookie
    ruleSequence: 20

This doesn't work as I am not able to set the pattern to match in the response header, so I end up with the following cookies coming back. Notice it's missing the CORS cookie (or any other cookie the application sets).

Set-Cookie: ApplicationGatewayAffinity=61bbd67c-8853-4454-910c-81978aee6710; Path=/; Secure

If I modify the rule in the Azure Portal to include the pattern to match in the response header section then it works as expected and I get the following. Note it has now not removed the CORS cookie.

Set-Cookie: ApplicationGatewayAffinityCORS=61bbd67c-8853-4454-910c-81978aee6710; Path=/; SameSite=None; Secure
Set-Cookie: ApplicationGatewayAffinity=61bbd67c-8853-4454-910c-81978aee6710; Path=/; Secure

Describe the solution you'd like
Need to add more fields to responseHeaderConfigurations in the CRD.
Looking at the documentation the fields should probably be pattern, negate, and ignoreCase

This would then allow the response header to be able to use all the options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions