# API7 Gateway 3.9.22 Release Notes

**Release Date**: 2026-10-27

## Upgrade Notes[​](#3922-upgrade-notes "Direct link to Upgrade Notes")

Upgrade note — upstream certificate verification settings now take effect

An upstream that sets `tls_verify: true` without referencing a client certificate or CA certificate object (`client_certificate` or `ca_certificates`), either on its own or together with the deprecated inline `tls` block, was delivered to the gateway without certificate verification, so the gateway accepted any upstream certificate. The Control Plane now delivers the setting, and the gateway verifies the upstream certificate. An upstream with `tls_verify: true` whose certificate the gateway does not trust now fails with `HTTP 502` where it previously succeeded. This is the intended behavior of the setting.

Upstreams of this shape that were saved before the upgrade keep running **without** verification after it, because the configuration delivered to gateways is regenerated only when a service is saved. To turn verification on for them, save each affected service again once the Control Plane is upgraded. Before you do, make sure the gateway trusts each upstream's certificate — reference the issuing CA through `ca_certificates` — or set `tls_verify` to `false` where verification is not wanted.

Two Data Plane fixes in this release enforce verification where it was previously skipped, and take effect as soon as a gateway instance is upgraded: `grpcs` upstreams now honor the verification settings they are delivered with, and a keepalive connection is no longer shared between upstreams whose verification settings differ. See Fixes for both. A `grpcs` upstream of the shape described above is still delivered without verification until its service is saved again, so upgrading the Data Plane alone does not turn verification on for it.

Upgrade note — inline `tls` can no longer be combined with certificate references

Creating or updating a service or an upstream whose upstream sets the deprecated inline `tls` block together with `client_certificate` or `ca_certificates` is now rejected with `HTTP 400` and `upstream tls cannot be used together with client_certificate or ca_certificates: tls is deprecated, configure the certificates with client_certificate and ca_certificates instead`. On 3.9.21 such a write was accepted, but the inline `tls` block was discarded when the configuration was delivered to the gateway, so an inline client certificate was never presented to the upstream. `tls_verify` is a switch, not a certificate reference, and can still be used with either.

Such an upstream that is already stored is delivered to gateways exactly as before, but the next update of its service or upstream is rejected until either the inline `tls` block or the certificate references are removed. Move the certificates into `client_certificate` and `ca_certificates` before editing it.

## Features[​](#3922-features "Direct link to Features")

### Plugins[​](#3922-features-plugins "Direct link to Plugins")

* **[Prometheus](https://docs.api7.ai/hub/prometheus.md)**
  * All four stream metrics — `apisix_stream_connection_total`, `apisix_stream_active_connections`, `apisix_stream_status` and `apisix_stream_bandwidth` — now carry `service` and `service_id` labels for the service of the matched stream route, following the same `prefer_name` rule as the HTTP metrics. Active connections and bandwidth are split per service while a session is still open. A session that does not reach a stream route with a service stays in the unlabelled total of its listening address. Each service seen on a listening address takes a slot in the stream metrics zone (`nginx_config.stream.metrics_zone_size`, `1m` by default, which holds about 750 slots). Once the zone is full, the active connections and bandwidth of a new service are counted only in the total of its listening address.

### Control Plane[​](#3922-features-control-plane "Direct link to Control Plane")

* A Nacos or Consul service registry can now be marked as not reachable from the Control Plane with the new `allow_control_plane_access` option, which defaults to `true`. When it is `false`, the Control Plane makes no requests to the registry, and the registry queries that fill the namespace, group, datacenter and service selectors are refused with `HTTP 400` and `control plane access to this service registry is disabled (allow_control_plane_access is false)` instead of failing with a connectivity error. The gateways still discover service nodes from the registry as before. In the Dashboard, the registry form has an **Allow Control Plane Access** switch, and a service using a registry with the switch off takes the service to discover, and for Nacos its namespace, group and metadata, as typed text instead of from selectors.
* The status of a service registry now reflects every online gateway instance of the gateway group instead of whichever instance reported last. A registry is `healthy` when all online instances reach it, `lost_connection` when none do, and the new `partially_lost_connection` when only some do, and the registry's API response lists the instances that have lost it in `lost_connection_instances`, with the hostname and the time each lost it. Offline instances are not counted. A new alert event, **Service Registry Lost Connection** (`service_registry_lost_connection`), notifies once when any online gateway instance of a gateway group has lost a registry for longer than the configured duration, and again only after it has recovered and lost it anew. In the Dashboard, a partially lost registry is shown with its own label, and hovering over the status lists the instances that lost it.

### Console (Dashboard)[​](#3922-features-console "Direct link to Console (Dashboard)")

* The quick start templates of the OpenID Connect plugin can be collapsed, leaving more room for the configuration editor. They are expanded when the plugin is added and collapsed when an existing configuration is edited or a template has been applied.

## Fixes[​](#3922-fixes "Direct link to Fixes")

### Plugins[​](#3922-fixes-plugins "Direct link to Plugins")

* **[Limit Count](https://docs.api7.ai/hub/limit-count.md)**, **[Limit Count Advanced](https://docs.api7.ai/hub/limit-count-advanced.md)** and **[GraphQL Limit Count](https://docs.api7.ai/hub/graphql-limit-count.md)**

  * Fixed issue: With `sync_interval` set, a gateway instance that only rejected requests stopped refreshing its cached quota from Redis once its local count expired, and kept rejecting on stale numbers until the cached quota itself ran out. With a sliding window, such an instance kept applying the previous window's weight for the rest of the window and admitted far fewer requests than the limit allows. When Redis was unreachable, such an instance also charged its local fallback counter at every synchronization, although it had admitted nothing.
  * Fixed issue: The Control Plane accepted a `rules` list in which two entries had the same `key`, although the gateway rejects it. The route, service, global rule, consumer or **[Workflow](https://docs.api7.ai/hub/workflow.md)** action was saved, but the gateway discarded it: a new route answered `HTTP 404`, and an updated one kept running its previous configuration. Such a configuration is now rejected with `HTTP 400` and `invalid limit-count plugin: duplicate key '<key>' in rules`.

* **[AI Proxy](https://docs.api7.ai/hub/ai-proxy.md)** and **[AI Proxy Multi](https://docs.api7.ai/hub/ai-proxy-multi.md)**
  * Fixed issue: For the Anthropic Messages protocol, the prompt token count left out cache read and cache creation tokens, and in a streaming response cache tokens reported only in the final `message_delta` event were not read at all. `$llm_prompt_tokens`, `$llm_total_tokens`, `apisix_llm_prompt_tokens`, and the quota consumed in **[AI Rate Limiting](https://docs.api7.ai/hub/ai-rate-limiting.md)** with the `total_tokens` or `prompt_tokens` strategy were therefore too low for requests that used prompt caching. Prompt tokens now include cache read and cache creation tokens, as they do for OpenAI-compatible providers. When an Anthropic client is served by an OpenAI-compatible upstream, `input_tokens` in the converted response no longer includes cache creation tokens, so it is no longer counted twice.

* **[OAS Validator](https://docs.api7.ai/hub/oas-validator.md)**
  * Fixed issue: A specification fetched from `spec_url` stayed in each worker's memory after no route used it anymore, and changing `spec_url_ttl` in the plugin metadata kept every specification of the previous cache. On a route whose `spec_url` changed often, such as a versioned specification URL, worker memory grew with every change until the worker ran out of memory. A specification that no request has used for `spec_url_ttl` seconds is now released.

### Data Plane[​](#3922-fixes-data-plane "Direct link to Data Plane")

* Fixed issue: An HTTPS upstream configured with certificate verification and its own CA certificate failed every request with `HTTP 502` and `upstream SSL certificate verify error: (20:unable to get local issuer certificate)` in the error log, even when the upstream certificate really was issued by that CA. The trusted store was never applied to an upstream that supplied a CA certificate without also supplying a client certificate. Such an upstream now connects.
* Fixed issue: A `grpcs` upstream ignored its certificate verification settings entirely, so an upstream certificate was accepted no matter which CA issued it. The settings were discarded by the internal redirect that dispatches gRPC traffic, and the upstream certificate was in any case checked against the wrong name. Verification and the configured CA certificates now take effect for `grpcs` as they do for `https`, and the certificate is checked against the upstream host. A `grpcs` upstream that has verification enabled and whose certificate does not chain to the configured CA, or whose subject alternative names do not cover the upstream host, now fails with `HTTP 502` where it previously connected; check those upstreams before upgrading.
* Fixed issue: An upstream that required certificate verification could reuse a keepalive connection opened earlier to the same host and port by an upstream that did not verify, or that verified against different CA certificates, so the request was sent without its own verification ever taking place. Connections are now pooled separately by verification setting and CA certificates. A request that succeeded only because it reused such a connection now fails with `HTTP 502`.
* Fixed issue: Two upstreams could share one parsed CA certificate store, so an upstream could be verified against another upstream's CA certificates. The store is now keyed on the CA certificates themselves.
* Fixed issue: Consul service discovery could stall when the catalog and health watches returned at about the same time. The gateway logged `bad argument #1 to 'str_sub' (string expected, got boolean)`, stopped picking up changes from the registry, and routes using it could answer `HTTP 503` with `consul service not found`. Each occurrence also leaked a connection in the gateway's privileged process, and once enough had leaked, none of its background tasks could run, heartbeats to the Control Plane included.
* Fixed issue: A service registry that was already unreachable when a gateway instance started, or when its configuration changed, was never reported as lost, so its status stayed `connecting` until it came back. A registry whose health check failed a single probe could also be reported as lost. Each gateway instance now reports a registry as lost only after its health check reaches the unhealthy threshold, and as healthy only after a successful probe.

### Control Plane[​](#3922-fixes-control-plane "Direct link to Control Plane")

* Fixed issue: A Nacos or Consul registry whose server address had no port, such as `http://registry.example`, was delivered to the gateway with an empty health check port when a health check was configured. The gateway then aborted the initialization of service discovery, so routes using other registries of the gateway group, including ones with an explicit port, could answer `HTTP 503`. The Control Plane now uses port `80` for `http` and `443` for `https`, the ports the gateway's registry client connects to. Existing registries pick up the port without being edited.
* Fixed issue: When a Nacos or Consul query made from the Dashboard failed, the error message, also shown in the Dashboard, could contain the registry credentials: the Nacos access token, the AK/SK signature parameters, and the user name of a `user:password@` server address. The message now shows only the host, the path and the cause of the failure.
* Fixed issue: When several global rules were written concurrently, as ADC does when it syncs global rule plugins in parallel, some plugins could be dropped from the configuration delivered to gateways while the Control Plane still listed them, and a later `adc sync` found no difference to repair. On SQL Server, such concurrent writes could also fail with `HTTP 500` or `HTTP 504` because of deadlocks. Every plugin written is now delivered, and concurrent writes no longer deadlock.
* Fixed issue: On a large audit log table, the nightly cleanup of expired audit logs timed out and was rolled back without deleting anything, so expired entries kept accumulating. Expired entries are now deleted in batches by their event time, and any backlog is cleared by the first cleanup after the upgrade.
* Fixed issue: The access log of the Data Plane Manager recorded the plaintext API key of every key-auth consumer lookup made by gateways, and a lookup for an unknown key returned the key in its `HTTP 404` response body. The key is now masked as `***` in the access log and is no longer included in the response.
* Fixed issue: When a debug session listed a trace that Jaeger no longer held — because it had aged out of retention, or because a Jaeger that keeps traces in memory had restarted — opening or downloading the trace failed with an empty `HTTP 500`, and so did any request while Jaeger could not be reached. The trace detail and download endpoints now answer `HTTP 410` with a message saying that the trace is no longer available in Jaeger, or `HTTP 503` with `Jaeger is unavailable`.

### Console (Dashboard)[​](#3922-fixes-console "Direct link to Console (Dashboard)")

* Fixed issue: In an alert policy, selecting a service or route for a status code event and then switching to another event kept the hidden service or route in the policy's scope.
