All Products
Search
Document Center

API Gateway:Configure a retry policy

Last Updated:Jun 03, 2026

Cloud-native API Gateway supports route-level retry policies that automatically retry failed requests. Retry conditions include connection failures, unavailable backend services, and specific HTTP status codes.

Route retry conditions

When a backend service returns a 5xx error, Cloud-native API Gateway retries the request based on the configured retry count.

image
  • HTTP retry conditions:

    • 5xx: Retries on any 5xx response, connection disconnect, reset, or read timeout.

      Note

      The 5xx condition includes the connect-failure and refused-stream conditions.

    • reset: Retries on connection disconnect, reset, or read timeout.

    • connect-failure: Retries on connection failure.

    • refused-stream: Retries when the backend resets a stream with the REFUSED_STREAM error code.

    • retriable-status-codes: Retries when the backend response matches a specified HTTP status code.

      Note

      To retry on specific status codes, select retriable-status-codes.

  • gRPC retry conditions:

    • cancelled: Retries when the backend returns a cancelled gRPC status.

    • deadline-exceeded: Retries when the backend returns a deadline-exceeded gRPC status.

    • internal: Retries when the backend returns an internal gRPC status.

    • resource-exhausted: Retries when the backend returns a resource-exhausted gRPC status.

    • unavailable: Retries when the backend returns an unavailable gRPC status.

Configure a route retry policy

  1. Choose a tab based on whether the API is inside or outside a gateway instance.

    API outside an instance

    1. Log in to the Cloud-native API Gateway console. In the left-side navigation pane, choose API and select a region.

    2. Click the target API. From the drop-down list, select the target instance, or select All instances.image

    3. Select the target route from the Routes.

    API inside an instance

    1. Log in to the Cloud-native API Gateway console. In the left-side navigation pane, choose Instance, and select a region.

    2. On the Instance page, click the target gateway instance ID. In the left-side navigation pane, choose API and click the target API.

    3. Select the target route from the Routes.

  2. Click the Configure Policy tab. In the Inbound Processing section, click Enable Policy/Plug-in.

  3. Click the Retry card. In the Add Policy: Retry panel, configure the parameters and click Add.

    Note

    After you enable the retry policy, verify that it works as expected.

    Parameter

    Description

    Enable

    Enables or disables the retry policy.

    • Enabled: The policy is active.

    • Disabled: The policy is inactive.

    Note

    When disabled, the gateway applies a default retry configuration: maximum 2 attempts with conditions connect-failure, refused-stream, unavailable, cancelled, and retriable-status-codes.

    Retry Times

    Maximum retry attempts for a failed request. Valid values: 0 to 10 (integer). Recommended: 2 or less.

    Note

    Setting the value to 0 disables retries.

    Retry Condition

    Select one or more retry conditions from the Route retry conditions list.

    Retry Status Code

    HTTP status codes that trigger a retry. You can enter multiple values.

    Note

    You can configure Retry Condition only if retriable-status-codes is selected as a Retry Status Code.