Skip to content
oRPC
Esc
navigateopen⌘Jpreview
On this page

Retry After Plugin

Retry After Plugin automatically retries requests according to the Retry-After response header. This is especially useful for handling rate limits and temporary server unavailability.

Usage

import { RetryAfterLinkPlugin } from '@orpc/client/plugins'

const link = new RPCLink({
  plugins: [
    new RetryAfterLinkPlugin(),
  ],
})

Options

By default, the plugin retries only requests that receive a 429 (Too Many Requests) or 503 (Service Unavailable) status code. It times out after 5 minutes and allows up to 3 retry attempts. You can customize this behavior with the following options:

const link = new RPCLink({
  plugins: [
    new RetryAfterLinkPlugin({
      condition: response => [429, 503].includes(response.status),
      timeout: 5 * 60 * 1000, // 5 minutes
      maxAttempts: 3,
    }),
  ],
})

Learn More

For implementation details, see the source code.

Last updated on August 6, 2026

Was this page helpful?