Skip to content

Opt-in retries for HTTP origin connections - #1745

Open
xhjkl wants to merge 1 commit into
cloudflare:masterfrom
xhjkl:feat/origin-connect-retries
Open

xhjkl wants to merge 1 commit into
cloudflare:masterfrom
xhjkl:feat/origin-connect-retries

Conversation

@xhjkl

@xhjkl xhjkl commented Sep 21, 2026

Copy link
Copy Markdown

This adds an optional retry window for HTTP origin connections. This can be helpful during application restarts or deployments, when an origin briefly stops listening on its TCP port or Unix socket. This way the public visitors will not see an outage, and the newest application deployment, once started up, will pick up the connections queued.

Notable Changes

  • Configuration: Adds originRequest.connectRetryTimeout, globally or per ingress rule. Retries are disabled by default; an explicit 0s disables an inherited setting. Negative values are rejected.
  • CLI outer surface: Adds --proxy-connect-retry-timeout and TUNNEL_PROXY_CONNECT_RETRY_TIMEOUT for origins configured through --url or --unix-socket.
  • Origin dialing logic: Routes the HTTP transport's DialContext through the retry helper, return dialOriginWithRetry(ctx, network, address, httpTransport.connectRetryTimeout, dialer.DialContext)
    The helper retries refused connections and missing Unix sockets using the existing exponential backoff with jitter. One deadline bounds all attempts and waits; connectTimeout still limits individual attempts.
  • Cancellation logic: Preserves request cancellation across the HTTP transport's detached dial context. Pending retries also stop when a request completes using a pooled connection, without canceling response-body streaming.
  • Serialization: Accepts fractional JSON durations so sub-second settings survive configuration round trips.

I'm assuming this change is small enough not to deserve an issue discussion, as per the contribution guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant