Siftil Documentation PT Sign in Create free account

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 runsVisitor IPGeo and ASNTLS, HTTP/3, header orderLatency (residential proxies)
Cloudflare Worker on your zoneyesyesyesyes
Vercel (Next.js, Edge or Node)yescountry, city, time zonenono
Node, Express, othersyesnonono

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):

PathWhat it does
/_r/agent.jsForwards the agent (cached).
/_r/challengeForwards the challenge, with the signed IP.
/_r/identifyForwards the identification, with signed IP and edge data.
/_r/pingAnswers locally, so latency measures browser ↔ your edge.

On your site:

html
<script src="/_r/agent.js"></script>
<script>
  const siftil = Siftil.identify({ endpoint: '/_r', apiKey: 'pk_…' })
</script>

Cloudflare Workers

  1. Download the ready-made worker: cloudflare-worker.js (no dependencies).
  2. Create a Worker in the account that owns your zone and deploy:
bash
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 deploy

Optional 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):

js
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

js
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

js
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:

HeaderValue
x-siftil-client-ipThe visitor's IP.
x-siftil-cfbase64url 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-proxyv1.<unix seconds>.<signature>, where signature = base64url(HMAC-SHA256(proxy secret, "<seconds>.<ip>.<x-siftil-cf>")). Valid for 5 minutes either way.
python
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

Siftil · API v1 documentation