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

Unix Domain Socket connection should use localhost authority header convention by default #442

Closed
kriswuollett opened this issue Jan 26, 2024 · 2 comments · Fixed by #445

Comments

@kriswuollett
Copy link
Contributor

The grpcurl client fails to work with the Rust tonic-based server on a Unix domain socket because the server expects an authority header.

% grpcurl -vv -d @ -plaintext -unix -protoset REDACTED/descriptor.bin  REDACTED/service.socket REDACTED/Reverse <<EOM
{ "text": "Hello, world!" }
EOM

Resolved method descriptor:
rpc Reverse ( .REDACTED.ReverseRequest ) returns ( .REDACTED.ReverseResponse );

Request metadata to send:
(empty)

Response headers received:
(empty)

Response trailers received:
(empty)
Sent 1 request and received 0 responses
ERROR:
  Code: Internal
  Message: stream terminated by RST_STREAM with error code: PROTOCOL_ERROR

For example, I'm able to use the Swift gRPC client fine since it sets authority.

Both tonic/h2 and kubernetes use localhost as the authority when using Unix domain sockets. The grpcurl client should as well.

The workaround, however inconvenient, is to manually specify the authority as localhost:

% grpcurl -vv -d @ -plaintext -unix -protoset REDACTED/descriptor.bin -authority "localhost"  REDACTED/service.socket REDACTED/Reverse <<EOM
{ "text": "Hello, world!" }
EOM

Resolved method descriptor:
rpc Reverse ( .REDACTED.ReverseRequest ) returns ( .REDACTED.ReverseResponse );

Request metadata to send:
(empty)

Response headers received:
content-type: application/grpc
date: Fri, 26 Jan 2024 02:46:38 GMT

Estimated response size: 15 bytes

Response contents:
{
  "text": "!dlrow ,olleH"
}

Response trailers received:
(empty)
Sent 1 request and received 1 response
@dragonsinth
Copy link
Member

Seems reasonable. Maybe a patch to default authority to localhost for unix sockets if not otherwise specified?

@kriswuollett
Copy link
Contributor Author

Yes, something simple like that. I can take a look at doing that tomorrow.

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

Successfully merging a pull request may close this issue.

2 participants