如何通过Curl请求Protobuf的type_url?关于Envoy配置示例中指定type_url请求返回404的疑问
Great question! Let’s unpack what’s happening here and how you can actually view the Protobuf type definition for TlsInspector.
Why you’re getting a 404
The Protobuf spec mentions that sending an HTTP GET to a type URL should return the protocol message type or an error—but this is a general recommendation, not a requirement that every service must implement.
Envoy does not host its Protobuf type definitions at type.googleapis.com. That domain is primarily used for Google’s own Protobuf types (like those in the google.protobuf or google.api packages). So when you run curl https://type.googleapis.com/envoy.extensions.listeners.tls_inspector.v3.TlsInspector, the 404 you see is exactly the "error message" the Protobuf docs refer to—it’s expected behavior here.
How to view the TlsInspector type definition
If you want to see the actual Protobuf structure for this Envoy component, here are a few reliable ways:
- Check Envoy’s source code: The
TlsInspectordefinition lives in the Envoy repo atextensions/listeners/tls_inspector/v3/tls_inspector.proto. You can browse this directly in the repo, or clone it locally to inspect the file. - Use Envoy’s official API documentation: Envoy’s docs have detailed references for every configuration type, including field descriptions and data types. Look up the
TlsInspectorlistener filter in the official docs to get all the details you need. - Protobuf command-line tools: If you have
protocinstalled and have cloned the Envoy repo, you can generate or inspect the descriptor set. For example:
You can then use tools likeprotoc --include_imports --descriptor_set_out=tls_inspector_desc.bin envoy/extensions/listeners/tls_inspector/v3/tls_inspector.protoprotoc --decode_rawor other Protobuf inspectors to parse this binary descriptor set.
Final note
Don’t worry about that 404—it’s just a sign that Envoy doesn’t use the type.googleapis.com endpoint for its custom types. Stick to the methods above to get the type definitions you need.
内容的提问来源于stack exchange,提问作者dippynark

