cdn.highseat.com, so their users never appear in your reports. A first-party proxy serves the tracker from your own domain instead. The script and its events use one path on your site, and the browser never contacts Highseat’s host.
Setup takes about ten minutes: one server route, two environment variables and a change to the script tag. Your current install keeps counting until the proxy goes live.
How it works
Your site gets its own proxy path, such as/3f9a0c1e2b: a slash and ten random hex characters. You mount createProxy(), a handler from the highseat package, on that path. A GET returns the tracker script, and a POST forwards a batch of events.
The handler adds two headers to every request it forwards:
x-hs-secretcarries your site secret, which starts withhs_secret_.x-hs-client-ipcarries the visitor’s IP address, read from your host’s own header.
x-hs-client-ip only when x-hs-secret matches the site the events are for. Without that check, anyone could send events under any IP.
This is why the proxy needs code. A plain rewrite to cdn.highseat.com cannot add the secret, so Highseat would see your server’s address on every visit. Every visitor would get your server’s country, and the bot filter would drop the visits as datacenter traffic.
The handler copies only the headers the tracker needs: user-agent, origin and content-type on events, user-agent and if-none-match on the script. Cookies, Authorization and the visitor’s other headers stay on your site.
Why the path is random
A filter list blocks a proxied tracker by matching a path that many sites share. A readable path such as/stats or /api/event is one rule away from blocking every site that uses it. A random path can only be listed one site at a time.
Highseat checks every proxy path against the public filter lists once a day. When a list blocks yours, Highseat emails the workspace’s owners and admins, and Site settings › Installation names the list and the rule. Highseat never moves the path for you: a path that changed on its own would break your deployed proxy.
What you need
Both values are in Site settings › Installation, in the Count visitors with ad blockers card:- Proxy path: the path your proxy answers on, set as
HIGHSEAT_PATH. - Site secret: click Generate, then set it as
HIGHSEAT_SECRET. The dashboard shows the secret once. Afterwards it shows only the last four characters, so a lost secret has to be rotated.
YOUR_PROXY_PATH and YOUR_SITE_ID in their place.
Next.js
A route handler and a wrapped
next.config.ts.TanStack Start
The proxy in your server entry.
Astro
An endpoint named after the path.
Cloudflare
A Worker in front of your site, or a Pages Function.
nginx
Two locations in your server block, with no package.
createProxy() takes a Request and returns a Response, so it also mounts on Netlify, on Vercel without Next.js, and in Hono. The highseat package README has the code for each.
Options
createProxy(options) from highseat/proxy or highseat/next returns the handler.
Pick the IP preset
A visitor can write any request header that your host does not overwrite. SocreateProxy() has no default and never falls back to X-Forwarded-For. Pick the preset for the outermost server that sets the header:
Behind a proxied Cloudflare record, use
cloudflare even with nginx or Traefik between Cloudflare and your app. In that setup, X-Real-IP holds a Cloudflare address rather than the visitor’s.
A missing variable never stops your site
WithoutHIGHSEAT_SECRET, the proxy turns itself off and logs one warning. So does a handler with a fallback and no HIGHSEAT_PATH. A handler with a fallback then sends every request there. One without a fallback answers the proxy path with 503 and a JSON error that names the variable. So a local server without the variables still starts and serves your site.
A secret with the wrong prefix is a copying mistake rather than a missing value, so it throws.
Check the proxy
Deploy, then open any page of your site. The card in Site settings › Installation turns green when an event arrives through the proxy. To check by hand, runcurl -i https://yoursite.com/YOUR_PROXY_PATH. A working proxy answers 200 with the script.
In your browser’s developer tools, the events are a POST to your own proxy path, not to cdn.highseat.com. Its response carries two headers from Highseat: x-hs-ip is the IP Highseat resolved, and x-hs-ip-source is where that IP came from. A working proxy shows x-hs-client-ip as the source and your own IP in x-hs-ip. These answers come from the proxy or from Highseat:
Any other status comes from Highseat itself, as in Verify your install.
Rotate the path or the secret
Both have a Rotate action in the card.- Rotate the path when a filter list blocks it. The old path keeps working until you deploy the new one, so you can rotate at any time. Update
HIGHSEAT_PATHand every other copy of the path, then redeploy. Next.js and TanStack Start read the variable alone. Elsewhere the path also sits in the script tag, and in one more place: the file name on Astro,_routes.jsonon Cloudflare Pages, the two locations on nginx. - Rotate the secret when it leaks. The old secret stops working within a minute. Highseat then refuses your proxy and your backend until both send the new one.