Skip to content
id0n

Reliability

Timeouts, retries, and how to keep repeated requests safe.

Gateway retries some failed requests on a fresh connection. A retry can reach your target a second time, so design every endpoint with side effects to be safe to repeat.

Timeouts

Each phase of a request has its own timeout. There is also a total limit, which applies to retries.

PhaseDefault
Connect to the target5 seconds
Send the request30 seconds
Read the response60 seconds
Total limit for retries120 seconds

The total limit is checked before each retry starts. It is not a hard deadline for an attempt already in progress, so one request can take longer than 120 seconds in total when the connect, send and read phases all run close to their own limits.

A timeout stops Gateway waiting. The target may still have completed the work.

Retries

RuleDefault
Retries per request1
Status codes that trigger a retry502, 503, 504
Methods retried on those status codesGET, HEAD, OPTIONS, QUERY

Retries on a status code apply only to the methods listed above. Retries after a connection or response failure follow different rules:

  • If sending the request to the target fails after part of a POST or other non-idempotent request has been sent, Gateway returns 502 and does not retry.
  • If the target accepts the request but then closes the connection without a response, sends a response Gateway cannot read or parse, or the read fails in some cases, Gateway can retry the request on another connection regardless of method. The target may already have acted on the first attempt.
  • A retry opens a fresh connection rather than reusing the failed one.
  • A response that is too large is not retried, because the result would be the same. See Responses.

POST and other effectful requests can be repeated

Do not rely on Gateway to send an effectful request exactly once. A request such as a payment or an order can reach your target twice if the first attempt was processed but no usable response came back.

Make targets safe to repeat

Treat every effectful endpoint behind Gateway as one that can receive the same request more than once.

  • Accept an idempotency key from the client, for example in an Idempotency-Key header, and store the result of the first request made with each key.
  • When a request arrives with a key you have already processed, return the stored result instead of repeating the effect.
  • Use the same approach for timeouts: a timeout does not prove the target did nothing.

Example

The total limit and the per-phase timeouts are set per route. In the current Gateway configuration format they look like this.

Example
{
  "routes": [
    {
      "path_prefix": "/api/",
      "upstream": "api",
      "connect_timeout_ms": 5000,
      "send_timeout_ms": 30000,
      "read_timeout_ms": 60000,
      "total_timeout_ms": 120000
    }
  ]
}

Available at release

How you apply configuration to a Gateway you use through id0n is published with the Gateway interface reference. Field names may change before release.

On this page

Ask AI

Answers come from the published id0n docs, with links to their sources.