Skip to content

Fixes #44 Bridge silently stops receiving changes behind Cloudflare Tunnel / reverse proxy #45

Open
evmin wants to merge 1 commit into
vrtmrz:mainfrom
evminco:pr/cloudflare-short-poll
Open

Fixes #44 Bridge silently stops receiving changes behind Cloudflare Tunnel / reverse proxy #45
evmin wants to merge 1 commit into
vrtmrz:mainfrom
evminco:pr/cloudflare-short-poll

Conversation

@evmin
Copy link
Copy Markdown

@evmin evmin commented Apr 19, 2026

Fixes #44

What this does

Adds an opt-in useShortPolling option for CouchDB peers. When enabled, the bridge polls _changes with short-lived HTTP requests instead of holding a persistent connection that reverse proxies silently kill.

Config

Three new optional fields on CouchDB peers (all backward-compatible, default off):

{
    "useShortPolling": true,
    "pollIntervalMs": 5000,
    "pollTimeoutMs": 50000
}

What's included

  • PeerCouchDB.ts — polling loop via Deno.fetch(), with chunk retry logic
  • types.ts — new config fields with JSDoc
  • readme.md — new "Cloudflare Tunnel / Reverse Proxy Support" section
  • dat/config.sample.json — fields added to sample

No changes to lib/ submodule. Original beginWatch() path is fully preserved when useShortPolling is false (default).

Testing

Running in production for 4+ weeks behind Cloudflare Tunnel (CouchDB 3.5.1, Deno 2.7.5). Create/edit/delete sync in 5-10s, checkpoint persistence across restarts, zero stalls since deployment.

…vironments

Add opt-in useShortPolling config option for CouchDB peers. When enabled,
replaces PouchDB's persistent _changes feed with periodic HTTP polling
via Deno fetch(), preventing silent stalls caused by proxy idle timeouts.

- useShortPolling (default: false) — opt-in, no behavior change for existing users
- pollIntervalMs (default: 5000) — interval between polls
- pollTimeoutMs (default: 50000) — HTTP timeout per request

Stable for 4+ weeks behind Cloudflare Tunnel with zero stalls.
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.

Bridge silently stops receiving changes behind Cloudflare Tunnel / reverse proxy

1 participant