Guides
Framework Integration
The c15t backend exposes a single handler with the signature (request: Request) => Promise<Response>. This is the standard Fetch API, so it works with any runtime that supports it — Node.js, Bun, Deno, and Cloudflare Workers.
Netlify Functions send an x-country header, which c15t reads the same way as cf-ipcountry and x-vercel-ip-country.
Bun
Next.js (App Router)
Create a catch-all API route that forwards requests to the handler:
Info
Use Next.js rewrites to proxy frontend requests through the same domain and avoid ad-blocker issues. See the Next.js Quickstart for the rewrite configuration.
Hono
Express
Fastify
Cloudflare Workers
Deno
CORS
The backend automatically handles CORS based on the trustedOrigins you configure:
Features:
wwwvariants are automatically allowed- Wildcard subdomain matching with
* localhostis allowed in development- Preflight
OPTIONSrequests are handled automatically
Native WebViews (Capacitor, Cordova/Ionic)
Entries without a scheme, or with http(s), match either protocol. Native
WebView shells serve the app from a custom scheme instead, so those origins must
be listed in full:
An entry that names an app scheme is pinned to it: capacitor://localhost is a
different origin from https://localhost, and it only matches that exact scheme
and host — adding capacitor://localhost does not trust
capacitor://anything-else.
Info
iOS defaults to capacitor://localhost. Apps migrated from
cordova-plugin-ionic-webview use ionic://localhost, and a custom
iosScheme produces
yourscheme://localhost — list whichever your app actually sends. A custom
server.hostname replaces the localhost half, giving
capacitor://app.example.com. Android serves from http:// and needs no
special handling. When in doubt, read the Origin header off the failing
request rather than guessing.