gRPC-go support: `message: : HTTP status code 521; transport: missing content-type field`

I’m testing the source code of this project https://github.com/Qv2ray/gun. It is based on grpc-go.

According to CloudFlare documentation, we need Content-Type in the header.
I’m not sure whether grpc-go sends this header field? If not, how to configure it to match this requirement?

$ grpcurl -proto ./pkg/proto/gun.proto  -vv my.domain.com:443 GunService/Tun

Resolved method descriptor:
rpc Tun ( stream .Hunk ) returns ( stream .Hunk );

Request metadata to send:
(empty)

Response trailers received:
(empty)
Sent 0 requests and received 0 responses
ERROR:
  Code: Unknown
  Message: : HTTP status code 521; transport: missing content-type field

What could be the reason?

Another related question: In 2019, I asked whether CloudFlare supports gRPC: gRPC support

At that time, it seems a paid feature.

In 2021, it should be available for free account?

I’ll answer this part. Yes, gRPC is now included with all plans.

“gRPC support is available on all Cloudflare plans for no additional fees. However, charges may occur for gRPC traffic over add-on products such as Argo Smart Routing, WAF, and Bot Management.”
https://support.cloudflare.com/hc/en-us/articles/360050483011

You can enable/disable gRPC under “Network” in the Cloudflare dashboard.

1 Like

@svanlund thanks!

I found the fundamental problem:

Full mode must be enabled. Otherwise, it would be treated as HTTP 1.1.

@Cloudflare we’d better to write this as well into the gRPC doc: https://support.cloudflare.com/hc/articles/360050483011

Full (Strict) SSL is the best and recommended, no issues with it at all and secure for everyone, kindly review your SSL settings and correct them:

By default, gRPC is an open source RPC framework running over HTTP/2, should run over HTTPS as currently Web browsers supports HTTP/2 over HTTPS:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.