Disable HTTP/2 on Gateway Listeners
API7 Gateway applies HTTP/2 to all client-facing HTTP and HTTPS proxy listeners in the same process. If one listener enables HTTP/2, every proxy port accepts it. Native gRPC traffic therefore cannot be isolated to one listener without a separate gateway deployment.
The setting does not affect stream, Admin API, status, or metrics listeners. REST-to-gRPC and gRPC-Web clients can continue over HTTP/1.1 because the gateway translates those requests before calling the native gRPC upstream.
Complete the change by updating every proxy listener, rolling out all gateway instances, and verifying both the generated configuration and fresh client connections.
Prerequisites
- Shell access to each gateway host or container, plus Docker or
kubectlfor containerized deployments. - A
curlbuild with HTTP/2 support. When the gateway certificate uses a private CA, also prepare that CA certificate for verification. - Inventory the effective HTTP and HTTPS listeners on every gateway instance.
- Identify any native gRPC clients that require HTTP/2.
- Confirm where TLS terminates and how to connect directly to each gateway instance. Testing only through a load balancer can hide a gateway that still accepts HTTP/2.
Update the Gateway Configuration
Disable HTTP/2 on every plaintext and HTTPS proxy listener. Leaving it enabled on one listener keeps HTTP/2 enabled for the shared proxy server.
Do not add a second listener to isolate native gRPC in the same gateway process. Use a separate gateway group or deployment when native gRPC requires a different protocol boundary, and restrict that deployment's network exposure.
- Configuration File
- API7 Gateway Helm
Back up the persistent gateway configuration and keep the backup until verification succeeds. Merge the following fragment into the complete active file; do not replace the file or its other settings:
apisix:
node_listen:
- port: 9080
enable_http2: false
ssl:
enable: true
listen:
- port: 9443
enable_http2: false
❶ Disables HTTP/2 on the plaintext proxy listener.
❷ Disables HTTP/2 on the HTTPS proxy listener.
Numeric plaintext entries, such as - 9080, and listener objects without the option already disable HTTP/2. Use the object form only when you need to set the option explicitly or preserve other listener fields.
Validate the complete configuration before replacing the running workers:
- Host or RPM
- Docker
sudo apisix test && \
sudo systemctl restart api7-gateway
export GATEWAY_CONTAINER="YOUR_GATEWAY_CONTAINER"
docker exec "$GATEWAY_CONTAINER" apisix test && \
docker restart "$GATEWAY_CONTAINER"
A reload starts new workers but can leave existing HTTP/2 connections on old workers until they drain. Restart or recreate the gateway when those connections must close before verification.
The chart enables HTTP/2 on its primary HTTPS listener by default. Merge this fragment into the complete values file; do not replace the file:
gateway:
tls:
http2:
enabled: false
Review existing entries under both gateway.http.additionalContainerPorts and gateway.tls.additionalContainerPorts. Remove any enable_http2: true value or set it to false. Preserve the other fields and entries in these lists; Helm replaces lists instead of merging their items.
Keep the previous values file until verification succeeds. Follow Update Values to retain the release's existing chart version and apply the complete file. With the chart's default RollingUpdate strategy, applying the updated values replaces the gateway pods gradually when the generated configuration changes.
Wait for the rollout before testing traffic:
export GATEWAY_NAMESPACE="YOUR_GATEWAY_NAMESPACE"
export GATEWAY_WORKLOAD="deployment/YOUR_GATEWAY_DEPLOYMENT"
kubectl rollout status "$GATEWAY_WORKLOAD" \
--namespace "$GATEWAY_NAMESPACE"
For a DaemonSet deployment, set GATEWAY_WORKLOAD to daemonset/YOUR_GATEWAY_DAEMONSET instead.
The command exits successfully when all updated replicas are available. Do not continue if the rollout times out or reports an unavailable replica.
Verify HTTP/2 Is Disabled
Inspect the Generated Configuration
Check every current gateway container or pod. HTTP/2 is disabled only when the generated proxy server contains no http2 on; directive.
- Host or RPM
- Docker
- Kubernetes
if grep -q "^[[:space:]]*http2 on;" /usr/local/apisix/conf/nginx.conf; then
echo "HTTP/2 is still enabled" >&2
exit 1
fi
echo "HTTP/2 is disabled"
export GATEWAY_CONTAINER="YOUR_GATEWAY_CONTAINER"
docker exec "$GATEWAY_CONTAINER" /bin/sh -c '
if grep -q "^[[:space:]]*http2 on;" /usr/local/apisix/conf/nginx.conf; then
echo "HTTP/2 is still enabled" >&2
exit 1
fi
echo "HTTP/2 is disabled"
'
export GATEWAY_NAMESPACE="YOUR_GATEWAY_NAMESPACE"
export GATEWAY_POD="YOUR_GATEWAY_POD"
kubectl exec --namespace "$GATEWAY_NAMESPACE" "$GATEWAY_POD" -- /bin/sh -c '
if grep -q "^[[:space:]]*http2 on;" /usr/local/apisix/conf/nginx.conf; then
echo "HTTP/2 is still enabled" >&2
exit 1
fi
echo "HTTP/2 is disabled"
'
If you reloaded a gateway instead of replacing its process, check for an old worker that is still draining:
- Host or RPM
- Docker
- Kubernetes
ps -eo pid,args | grep "[w]orker process"
docker exec "$GATEWAY_CONTAINER" ps -o pid,args \
| grep "[w]orker process"
kubectl exec --namespace "$GATEWAY_NAMESPACE" "$GATEWAY_POD" -- \
ps -o pid,args | grep "[w]orker process"
Wait until the output contains no worker process is shutting down entry before treating existing connections as drained.
Test HTTPS Listeners
Open a fresh connection to each HTTPS listener with a curl build that supports HTTP/2:
export GATEWAY_IP="YOUR_GATEWAY_IP"
curl --http2 --silent --show-error --output /dev/null \
--write-out '%{http_version}\n' \
--noproxy gateway.example.com \
--resolve "gateway.example.com:9443:$GATEWAY_IP" \
"https://gateway.example.com:9443/health-check-path"
Replace the hostname, port, address, and path with values for the instance being tested. The command connects directly to the gateway while retaining the hostname for SNI and certificate verification. Add --cacert /path/to/ca.crt when the gateway certificate uses a private CA.
The command prints 1.1 when TLS negotiates HTTP/1.1.
Test Plain Text Listeners
First confirm that an ordinary HTTP/1.1 request reaches the plaintext listener:
export GATEWAY_IP="YOUR_GATEWAY_IP"
export GATEWAY_HTTP_URL="http://$GATEWAY_IP:9080/health-check-path"
curl --http1.1 --silent --show-error --output /dev/null \
--write-out '%{http_version}\n' \
--noproxy "$GATEWAY_IP" \
-H "Host: gateway.example.com" \
"$GATEWAY_HTTP_URL"
The command prints 1.1 and exits successfully. Then send the HTTP/2 connection preface on a new connection:
curl --http2-prior-knowledge --silent --show-error --output /dev/null \
--write-out '%{http_version}\n' \
--noproxy "$GATEWAY_IP" \
-H "Host: gateway.example.com" \
"$GATEWAY_HTTP_URL"
When HTTP/2 is disabled, the prior-knowledge command exits nonzero because the listener does not return the HTTP/2 settings frame. A successful command that prints 2 means HTTP/2 is still enabled. The initial HTTP/1.1 request distinguishes the expected failure from an unreachable listener.
Restore HTTP/2
Restore the required listener or Helm setting and roll out every gateway instance again. Verify that the intended native gRPC request succeeds through each updated instance.