solo-io / gloo

The Feature-rich, Kubernetes-native, Next-Generation API Gateway Built on Envoy
https://docs.solo.io/
Apache License 2.0
4.08k stars 438 forks source link

wrapAsApiGateway transforming host header to authority #8207

Open jaymiracola opened 1 year ago

jaymiracola commented 1 year ago

Gloo Edge Version

1.14.x (latest stable)

Kubernetes Version

None

Describe the bug

When setting wrapAsApiGateway to true, the host header is transformed to the HTTP/2 authority header.

Steps to reproduce the bug

  1. VS
    virtualHost:
    domains:
    - '*'
    routes:
    - matchers:
      - exact: /
      options: {}
      routeAction:
        single:
          destinationSpec:
            aws:
              wrapAsApiGateway: true
              logicalName: hello
          upstream:
            name: aws-upstream
            namespace: gloo-system
  2. US
    spec:
    aws:
    lambdaFunctions:
    - lambdaFunctionName: echo
      logicalName: echo
      qualifier: $LATEST
    - lambdaFunctionName: hello
      logicalName: hello
      qualifier: $LATEST
    region: us-east-2
    secretRef:
      name: aws-creds
      namespace: gloo-system
  3. Lambda code to print request header to body for testing
    exports.handler = async (event) => {
    const response = {
        statusCode: 200,
        headers: {
            'Content-Type': 'application/json',
        },
        body: JSON.stringify({
            msg: "hello world",
            receivedHeaders: event.headers
        }),
    };
    return response;
    };
  4. curl
    curl http://acf06d6774aef420b831b17d6e19c93f-1955450139.us-east-2.elb.amazonaws.com/ -H "Host: foo.bar" --http1.1    
    {"statusCode":200,"headers":{"Content-Type":"application/json"},"body":"{\"msg\":\"hello world\",\"receivedHeaders\":{\":authority\":\"foo.bar\",\":method\":\"GET\",\":path\":\"/\",\":scheme\":\"http\",\"accept\":\"*/*\",\"user-agent\":\"curl/7.87.0\",\"x-forwarded-proto\":\"http\",\"x-request-id\":\"851c635f-c471-48a1-8117-a49317c7ff33\"}}"}

Expected Behavior

Mirror what is produces by the AWS Application Gateway . Preserve the header host as host

Additional Context

No response

github-actions[bot] commented 4 months ago

This issue has been marked as stale because of no activity in the last 180 days. It will be closed in the next 180 days unless it is tagged "no stalebot" or other activity occurs.