solo-io / gloo-portal-issues

Public tracker for issues related to Gloo Portal
https://docs.solo.io/gloo-portal/latest/
1 stars 3 forks source link

Failing to apply new-header transform in Portal 1.0 at virtualHost level #74

Open jameshbarton opened 2 years ago

jameshbarton commented 2 years ago

Describe the bug I'm experimenting with adding a new header (foo: bar) in a requestTransformation and cannot get it to apply to the request.

I began with an example like the standard Portal docs but modified it to use httpbin as upstream rather than petstore. The basics work fine. I can access it use api-key authNZ from both CLI and portal UI. I then tried to use the new request transformation integration at the virtualHost level with Edge. I see the transform in the Envoy config but it is not applied to the request being sent to the upstream.

To Reproduce Note that this config is deployed in solo-test GKE project.

  1. curl the httpbin endpoint exposed through portal VS.
    
    curl http://34.139.42.235/get -i -H 'api-key: MTZjODUxYmMtOGExZi05NDA3LTViYTAtNjZlN2RmOTc1NGUz' -H 'Host: api.example.com'
    HTTP/1.1 200 OK
    server: envoy
    date: Wed, 07 Jul 2021 18:42:26 GMT
    content-type: application/json
    content-length: 415
    access-control-allow-origin: *
    access-control-allow-credentials: true
    x-envoy-upstream-service-time: 2

{ "args": {}, "headers": { "Accept": "/", "Api-Key": "MTZjODUxYmMtOGExZi05NDA3LTViYTAtNjZlN2RmOTc1NGUz", "Host": "api.example.com", "User-Agent": "curl/7.64.1", "X-Envoy-Expected-Rq-Timeout-Ms": "15000", "X-Solo-Plan": "basic", "X-User-Id": "httpbin-product-basic-0c2bfac7-7097-36f9-1537-f6568cd44e4e" }, "origin": "10.92.0.7", "url": "http://api.example.com/get"


2. Note that `foo: bar` header is not present in the httpbin output.

Attaching a [zip](https://github.com/solo-io/gloo-portal-issues/files/6779502/Archive.zip) with the Environment that specifies the transformation, the generated VS, and the Envoy proxy config.

**Expected behavior**
The `foo: bar` header should be present as part of httpbin "headers" output.

**Additional context**
- Gloo Portal version 1.0.0
- Gateway technology and version: Gloo Edge Enterprise v1.8.0
arianaw66 commented 2 years ago

Looks like the VHost transform is being overwritten by the following transform we add at the route level:

            requestTransformation:
              transformationTemplate:
                dynamicMetadataValues:
                - key: environment
                  value:
                    text: httpbin-dev.default
                - key: api_product
                  value:
                    text: httpbin-product.default
                passthrough: {}

We should consider how best to address this and at the very least update the description on VHost options here.