You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A gRPC service may be accessible at multiple endpoints and knowing the hostname can be meaningful.
With HTTP1.1 this is usually available as the Host header and could have been accessed from the MetadataMap, but given the HTTP/2 context the right way to access this is the authority pseudoheader from the URI.
Had a go at plumbing this up, and it's not pretty. Another solution could be to add the Uri as an extension (by default, can be done by a custom layer already of course)...
Feature Request
Crates
tonic
Motivation
A gRPC service may be accessible at multiple endpoints and knowing the hostname can be meaningful.
With HTTP1.1 this is usually available as the
Host
header and could have been accessed from theMetadataMap
, but given the HTTP/2 context the right way to access this is the authority pseudoheader from the URI.https://docs.rs/http/latest/http/request/struct.Request.html#method.uri
https://docs.rs/http/latest/http/uri/struct.Uri.html#method.authority
However, this is not currently available to tonic services.
Proposal
Add a
uri: Uri
field totonic::Request
and a getter for it. This field should be copied over from thehttp::Request
.Alternatives
A layer that adds the URI or required components (e.g.
request.uri().authority()
) as an extension.The text was updated successfully, but these errors were encountered: