Skip to content

ResponseHeaderModifier does not permit to set a content with commas #5733

Open
@saez0pub

Description

@saez0pub

Description:

I cannot set Cache-Control: foo,bar with ResponseHeaderModifier

Repro steps:

  1. Deploy the quickstart example
  2. Apply the following HTTPRoute:
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: backend
  namespace: default
spec:
  hostnames:
  - www.example.com
  parentRefs:
  - group: gateway.networking.k8s.io
    kind: Gateway
    name: eg
  rules:
  - backendRefs:
    - group: ""
      kind: Service
      name: backend
      port: 3000
      weight: 1
    filters:
    - responseHeaderModifier:
        set:
        - name: Cache-Control
          value: private, no-store
      type: ResponseHeaderModifier
    matches:
    - path:
        type: PathPrefix
        value: /
  1. Run the following curl command:

curl -i http://${ENVOY_GATEWAY_IP}/-H 'Host: www.example.com' -H 'X-Echo-Set-Header: Cache-control: value1' | grep ^cache-control
You will see This:

cache-control:  no-store

Expected output:

cache-control: private, no-store

Proxy config extract:

          "response_headers_to_add": [
           {
            "header": {
             "key": "Cache-Control",
             "value": "private"
            },
            "append_action": "OVERWRITE_IF_EXISTS_OR_ADD"
           },
           {
            "header": {
             "key": "Cache-Control",
             "value": " no-store"
            },
            "append_action": "OVERWRITE_IF_EXISTS_OR_ADD"
           }
          ],

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededkind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions