You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Call the API through a service binding and forward the visitor #449
Every server-side API call this site makes leaves from the same small pool of Cloudflare egress addresses, so the API's per-IP limiter counts all visitors as one client (nemar-cli#1709).
That is what produced the "Could not load datasets" errors on /discover, and it is also why the strict sign-in bucket is shared by every visitor (nemar-cli#1354).
The API side is nemar-cli#1710: a request with no CF-Connecting-IP (which is what a service-binding call is) is counted by the visitor in X-Forwarded-For.
Plan
Code, inert without a binding: a single apiFetch helper that uses a service binding named API when the runtime provides one and the public network otherwise, and sets X-Forwarded-For to the visitor's CF-Connecting-IP (replacing whatever the visitor sent).
Every server-side call to api.nemar.org, data.nemar.org and zarr.nemar.org goes through it.
The request context (request-context.ts) carries the binding and the visitor address, so the catalog cache's background refresh is attributed to the visitor that triggered it.
Wiring, after nemar-cli#1710 is deployed to the matching environment: [[services]] in wrangler.test.toml (to nemar-api-dev) first, then in wrangler.toml (to nemar-api).
Wiring before the API change is deployed would put every call in the API's shared unattributed bucket, which is worse than today.
Verify with the API's X-RateLimit-Bucket header and the [rate-limit] log lines named in nemar-cli ADR 0098.
Not in scope
The browser's own calls (they carry their own CF-Connecting-IP).
API side: nemar-cli#1710 (a forwarded visitor is counted on their own, site-ip, fixed windows, anonymous cap 1000) merged to dev and deployed to nemar-api-dev; review follow-ups nemar-cli#1723 merged to dev (899ecb07).
test.nemar.org is bound to nemar-api-dev: its logs show the calls going over the binding with no errors. The development API bypasses its limiter, so the one warning there is expected ("carried no rate-limit headers"); staging proves the path, not the keying.
Production: needs nemar-cli 0.10.17 released to main and deployed to nemar-api first. The website release that carries [[services]] API -> nemar-api must not be promoted before that (AGENTS.md step 8, .context/handoff.md). Then check on nemar.org: X-RateLimit-Bucket: site-ip with a falling X-RateLimit-Remaining across two calls, and the [api-fetch] first-call line (site-ip, info) in the production deployment's tail.
Follow-ups: data.nemar.org and zarr.nemar.org through the binding (zone cache question); the browser-reachable API client modules (they cannot import apiFetch); website#451 (bound the detail calls a Discover search makes per page); nemar-cli#1712 to #1718 (review follow-ups filed from #1710).
Shipped in 0.2.31, promoted to production through #457 (merge commit 8468a2e, tag v0.2.31). The service binding (API to nemar-api), apiFetch and the converted call sites, including the news pages from #456, are live; the production site logs show calls counted per visitor in the API's site-ip bucket (nemar-cli#1709 has the evidence). Closing by hand, since a merge to staging does not close issues.
Activity
Send server-only API calls over a service binding
Bind the API Worker for server-side calls
neuromechanist commentedon Oct 12, 2026
Status as of 2026-10-12.
site-ip, fixed windows, anonymous cap 1000) merged todevand deployed tonemar-api-dev; review follow-ups nemar-cli#1723 merged todev(899ecb07).apiFetchand the call sites (Call the API through a service binding that names the visitor #450, ADR 0026) and the wiring (Bind the API Worker for server-side calls #452) merged tostaging.nemar-api-dev: its logs show the calls going over the binding with no errors. The development API bypasses its limiter, so the one warning there is expected ("carried no rate-limit headers"); staging proves the path, not the keying.mainand deployed tonemar-apifirst. The website release that carries[[services]] API -> nemar-apimust not be promoted before that (AGENTS.md step 8,.context/handoff.md). Then check on nemar.org:X-RateLimit-Bucket: site-ipwith a fallingX-RateLimit-Remainingacross two calls, and the[api-fetch]first-call line (site-ip, info) in the production deployment's tail.apiFetch); website#451 (bound the detail calls a Discover search makes per page); nemar-cli#1712 to #1718 (review follow-ups filed from #1710).Send the news reads over the API binding (#456)
neuromechanist commentedon Oct 13, 2026
Shipped in 0.2.31, promoted to production through #457 (merge commit 8468a2e, tag v0.2.31). The service binding (
APItonemar-api),apiFetchand the converted call sites, including the news pages from #456, are live; the production site logs show calls counted per visitor in the API'ssite-ipbucket (nemar-cli#1709 has the evidence). Closing by hand, since a merge tostagingdoes not close issues.