- 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.1k
 
Description
Title: Headers set by router are no longer accessible in request_headers_to_add
Description:
We were mapping x-envoy-expected-rq-timeout-ms header into a different one, which stopped working when we upgraded from v1.34.0 to v1.35.0
    request_headers_to_add:
    - header:
        key: "x-timeout"
        value: '%REQ(x-envoy-expected-rq-timeout-ms)%'
      append_action: ADD_IF_ABSENTUsing dev images, I was able to narrow it down to these commits 0672c68...0c00c89. Those don't have any image associated with them so I wasn't able to pinpoint the exact commit which introduced this change, but I suspect it stopped working due to 4453ce1, since it changes the timing of when the finalizeRequestHeaders is called.
Reporting it as bug since I didn't find this behaviour change in the release notes nor in the PR/commit descriptions.
I was also able to verify that this affects other headers (e.g. x-envoy-attempt-count), so it's not specific to x-envoy-expected-rq-timeout-ms.
Repro steps:
Using the envoy.yaml and docker-compose.yaml I attached below, run the following commands, and observe the headers that are being logged.
docker compose up
curl http://localhost:10000/fooWhen using envoyproxy/envoy:v1.34.0 image (and envoyproxy/envoy:dev-0672c682568ea2745d7a1433ef5c47353e728ffc) I'm seeing x-envoy-expected-rq-timeout-ms correctly being mapped to x-timeout, whereas with envoyproxy/envoy:v1.35.0 (and envoyproxy/envoy:dev-0c00c8960e845c0b089039908f9692b6dd50ce1e) that no longer works.
Config:
# envoy.yaml
admin:
  address:
    socket_address:
      address: 0.0.0.0
      port_value: 9902
static_resources:
  listeners:
  - name: outbound_listener
    address:
      socket_address:
        address: 0.0.0.0
        port_value: 10000
    filter_chains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          stat_prefix: outbound_http
          route_config:
            name: local_route
            virtual_hosts:
            - name: echo
              domains: ["*"]
              routes:
              - match: { prefix: "/" }
                route:
                  cluster: echo
                request_headers_to_add:
                # the behaviour that's broken with the upgrade to v1.35.0
                - header:
                    key: "x-timeout"
                    value: '%REQ(x-envoy-expected-rq-timeout-ms)%'
                  append_action: ADD_IF_ABSENT
          http_filters:
          - name: envoy.filters.http.router
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
  clusters:
  - name: echo
    type: STRICT_DNS
    connect_timeout: 5s
    load_assignment:
      cluster_name: echo
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: "echo"
                port_value: 8080# docker-compose.yaml
services:
  echo:
    image: mendhak/http-https-echo
  envoy:
    # image: envoyproxy/envoy:v1.34.0
    image: envoyproxy/envoy:v1.35.0
    volumes:
      - ./envoy.yaml:/etc/envoy/envoy.yaml
    ports:
      - "10000:10000"
      - "9902:9902"
    depends_on:
      - echo