grpc / grpc-swift-nio-transport

Apache License 2.0
6 stars 8 forks source link

Authority header is never passed from client #29

Open rosecoder opened 4 hours ago

rosecoder commented 4 hours ago

The :authority-header is never passed. This is an issue where all calls to APIs and services in Google Cloud Platform will fail due to their backend can not route the request resulting in a drop of request (with a RST_STREAM).

Looking at the headers passed, the :authority-header is missing: https://github.com/grpc/grpc-swift-nio-transport/blob/565aae3d57c227a40389862dd4923da09c9ed452/Sources/GRPCNIOTransportCore/GRPCStreamStateMachine.swift#L639-L648

According to the documentation linked in the code, it's required by gRPC: https://github.com/grpc/grpc/blob/7f664c69b2a636386fbf95c16bc78c559734ce0f/doc/PROTOCOL-HTTP2.md#requests

Currently no workaround for this from a library consumer perspective due to pseudo headers must come first.

rosecoder commented 2 hours ago

I did a quick fix for this: https://github.com/grpc/grpc-swift-nio-transport/compare/main...rosecoder:grpc-swift-nio-transport:authority-header?expand=1

It's not optimal solution, but let me know if I should open a PR.