Hello. We attempted to deploy an api-gateway in our infrastructure according to the instructions on the website:
But we encountered a problem with using http2.
If you configure the api-gateway:
Kind = "api-gateway"
Name = "my-api-gateway"
Listeners = [
{
Port = 8088
Name = "my-http-listener"
Protocol = "http"
}
add an http-route:
Kind = "http-route"
Name = "my-http-route"
Rules = [
{
Matches = [
{
Path = {
Match = "prefix"
Value = "/hello"
}
}
]
Services = [
{
Name = "hello-app"
}
]
}
]
Parents = [
{
Kind = "api-gateway"
Name = "my-api-gateway"
SectionName = "my-http-listener"
}
]
add service-defaults for the service
Kind = "service-defaults"
Name = "hello-app"
Protocol = "http"
After this, the service is available through the api-gateway
consul config read -kind http-route -name my-http-route
...
"Status": {
"Conditions": [
{
"Type": "Accepted",
"Status": "True",
"Reason": "Accepted",
"Message": "route is valid",
"Resource": {
"Kind": "",
"Name": "",
"SectionName": ""
},
"LastTransitionTime": "2024-10-19T11:31:40.490805155Z"
},
{
"Type": "Bound",
"Status": "True",
"Reason": "Bound",
"Message": "successfully bound route",
"Resource": {
"Kind": "api-gateway",
"Name": "my-api-gateway",
"SectionName": "my-http-listener"
},
"LastTransitionTime": "2024-10-19T11:31:40.49082908Z"
}
]
}
If the hello-app application responds via http1, everything works, but if the hello-app application responds via http2, we cannot connect through the api-gateway and get an error. At this point, we see a protocol error in the envoy-sidecar logs
Error dispatching received data: http/1.1 protocol error: HPE_INVALID_CONSTANT
If we change the protocol of the service to http2
Kind = "service-defaults"
Name = "hello-app"
Protocol = "http2"
then right after this, the service becomes unavailable through the api-gateway, and we see the following status
consul config read -kind http-route -name my-http-route
...
"Status": {
"Conditions": [
{
"Type": "Accepted",
"Status": "False",
"Reason": "InvalidDiscoveryChain",
"Message": "route protocol does not match targeted service protocol",
"Resource": {
"Kind": "",
"Name": "",
"SectionName": ""
},
"LastTransitionTime": "2024-10-19T11:29:39.681685521Z"
},
{
"Type": "Bound",
"Status": "False",
"Reason": "FailedToBind",
"Message": "failed to bind route to gateway my-api-gateway: route has not been accepted",
"Resource": {
"Kind": "api-gateway",
"Name": "my-api-gateway",
"SectionName": "my-http-listener"
},
"LastTransitionTime": "2024-10-19T11:29:39.681705076Z"
}
]
}
Is it possible to configure the api-gateway to manage routes at the Layer 7 and serve services running on http2? The tcp-listener does not suit us, as it would require raising a separate port for each application.