First-party proxy
Ad blockers and tracker lists block third-party domains. With the proxy, the agent talks to your domain (www.yoursite.com/_r/…) and your server forwards to Siftil. For the browser, everything is first-party.
The proxy also forwards the visitor's real IP and what your edge saw of the connection, signed with your account's proxy secret. Without a valid signature Siftil rejects the request (401): nobody can forge an IP through the proxy.
| Where the proxy runs | Visitor IP | Geo and ASN | TLS, HTTP/3, header order | Latency (residential proxies) |
|---|---|---|---|---|
| Cloudflare Worker on your zone | yes | yes | yes | yes |
| Vercel (Next.js, Edge or Node) | yes | country, city, time zone | no | no |
| Node, Express, others | yes | no | no | no |
On Cloudflare you lose no signal at all. Elsewhere, everything that comes from the browser stays the same (bots, anti-detect, tampering, VMs, incognito, behaviour, ID) and the IP lists (VPN, datacenter, Tor, attacks) still apply; only the signals that need to see the connection are left out.
Routes
The proxy serves four paths below the prefix (default /_r):
| Path | What it does |
|---|---|
/_r/agent.js | Forwards the agent (cached). |
/_r/challenge | Forwards the challenge, with the signed IP. |
/_r/identify | Forwards the identification, with signed IP and edge data. |
/_r/ping | Answers locally, so latency measures browser ↔ your edge. |
On your site:
<script src="/_r/agent.js"></script>
<script>
const siftil = Siftil.identify({ endpoint: '/_r', apiKey: 'pk_…' })
</script>Cloudflare Workers
- Download the ready-made worker: cloudflare-worker.js (no dependencies).
- Create a Worker in the account that owns your zone and deploy:
mkdir siftil-proxy && cd siftil-proxy
curl -o worker.js https://siftil.com/integrations/cloudflare-worker.js
cat > wrangler.toml <<'TOML'
name = "siftil-proxy"
main = "worker.js"
compatibility_date = "2026-11-01"
routes = [{ pattern = "www.yoursite.com/_r/*", zone_name = "yoursite.com" }]
TOML
npx wrangler secret put SIFTIL_PROXY_SECRET # paste the proxy secret from the dashboard
npx wrangler deployOptional variables: SIFTIL_PREFIX (default /_r) and SIFTIL_ORIGIN (default https://siftil.com).
Next.js (App Router)
Copy proxy.mjs to lib/siftil-proxy.mjs and create app/%5Fr/[...path]/route.js (in the App Router, folders that start with _ are private; %5F is how Next.js creates the /_r route):
import { createProxyHandler } from '@/lib/siftil-proxy.mjs'
const handle = createProxyHandler({ secret: process.env.SIFTIL_PROXY_SECRET, prefix: '/_r' })
export const GET = (req) => handle(req)
export const POST = (req) => handle(req)
export const runtime = 'edge' // or 'nodejs'On Vercel the IP comes from x-forwarded-for, and country, city and time zone from the x-vercel-ip-* headers, with no configuration. Put SIFTIL_PROXY_SECRET in the project's environment variables.
Express and Node
import express from 'express'
import { siftilExpress } from './siftil-proxy.mjs'
const app = express()
app.set('trust proxy', true)
app.use('/_r', siftilExpress({ secret: process.env.SIFTIL_PROXY_SECRET }))siftilExpress reads the IP from x-forwarded-for (first in the list). If Node is exposed directly, with no load balancer in front, use siftilExpress({ secret, trustProxy: false }) to use the socket IP.
Hono, Bun, Deno and other Fetch API servers
import { createProxyHandler } from './siftil-proxy.mjs'
const handle = createProxyHandler({ secret: process.env.SIFTIL_PROXY_SECRET })
// Hono
app.all('/_r/*', (c) => handle(c.req.raw, { ip: c.req.header('x-real-ip') }))
// Bun
Bun.serve({ fetch: (req, srv) => new URL(req.url).pathname.startsWith('/_r/') ? handle(req, { ip: srv.requestIP(req)?.address }) : app(req) })The second argument of handle accepts { ip, cf } for platforms that expose the IP some other way.
Other languages
The protocol is simple. For every request to /v1/challenge and /v1/identify, forward the browser headers (except host, cookie and proxy headers) and add:
| Header | Value |
|---|---|
x-siftil-client-ip | The visitor's IP. |
x-siftil-cf | base64url JSON with what the edge saw (may be e30, which is {}). Accepted fields: asn, asOrganization, country, city, region, timezone, latitude, longitude, httpProtocol, tlsVersion, tlsClientCiphersSha1, tlsClientExtensionsSha1, tlsClientHelloLength, clientTcpRtt, clientQuicRtt, requestHeaderNames, verifiedBotCategory. |
x-siftil-proxy | v1.<unix seconds>.<signature>, where signature = base64url(HMAC-SHA256(proxy secret, "<seconds>.<ip>.<x-siftil-cf>")). Valid for 5 minutes either way. |
import base64, hmac, hashlib, json, time
def siftil_headers(secret: str, ip: str, cf: dict) -> dict:
cf64 = base64.urlsafe_b64encode(json.dumps(cf, separators=(',', ':')).encode()).rstrip(b'=').decode()
ts = str(int(time.time()))
sig = hmac.new(secret.encode(), f'{ts}.{ip}.{cf64}'.encode(), hashlib.sha256).digest()
return {
'x-siftil-client-ip': ip,
'x-siftil-cf': cf64,
'x-siftil-proxy': f'v1.{ts}.' + base64.urlsafe_b64encode(sig).rstrip(b'=').decode(),
}Answer /_r/ping locally with 1, cache-control: no-store and timing-allow-origin: *.
Security
- The proxy secret stays on the server. If it leaks, ask support to rotate it; you rotate the secret and public keys yourself in the dashboard.
- The proxy does not forward your domain's cookies to Siftil.
- Authorized origins still apply: the proxy forwards the browser's
Originheader.
Siftil · API v1 documentation