Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting :authority in initial_metadata creates two :authority values #199

Open
collinlee opened this issue Jun 8, 2023 · 3 comments
Open

Comments

@collinlee
Copy link

collinlee commented Jun 8, 2023

When I attempt to set the initial_metadata value as a vector in dispatch_grpc_call like so


dispatch_grpc_call(
                    "upstream-cluster",
                    "test.Service",
                    "testMethod",
                    vec![
                        (":scheme", "https".as_bytes()),
                        (":authority", "foo.aws.foobar.cl".as_bytes())
                    ],
                    Some(request.write_to_bytes().unwrap().as_slice()),
                    Duration::from_secs(2),
)

I see in the Envoy logs that the headers sent are

':authority', 'upstream-cluster,foo.aws.foobar.cl'

Is there a way that :authority can only be set to foo.aws.foobar.cl?

@PiotrSikora
Copy link
Member

gRPC's initial metadata is supplemental metadata that's encoded as HTTP headers, but those shouldn't be used as HTTP headers, and you cannot use it to override HTTP headers.

Having said that, it looks that Envoy implementation has a bug that allows setting two :authority values, which it concatenates.

Could you open issue there? Thanks! cc @mpwarres

@PiotrSikora
Copy link
Member

Also, answering your original question, I think you should be able to configure :authority in upstream-cluster's configuration in Envoy using the Endpoint's hostname field.

@collinlee
Copy link
Author

I've tried to see if in the cluster definition under load_assignment setting hostname in endpoint as you mentioned, but it doesn't seem to use that value in the authority header

          load_assignment:
            cluster_name: upstream-cluster
            endpoints:
              - lb_endpoints:
                  - endpoint:
                      hostname: foo.aws.foobar.cl
                      address:
                        socket_address:
                          address: foo.aws.foobar.cl
                          port_value: 80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants