Skip to content
Zarex

Where every request comes from

Every decision gives the country and network (ASN) of the visitor's address. Filter by country or network, and optionally block Tor exits, commercial VPNs and browsers coming from hosting providers.

Scenario

ALLOW · allowed

Every decision contains the country (ISO code) and network of the address. ZZ and AS0 mean an unknown or private address.

Zarex response· excerptDocs

{
  "verdict": "ALLOW",
  "ip": {
    "country": "US",
    "asn": "AS15169"
  }
}

Country and network, in every decision

Zarex looks up its own address database: no query is sent to a third party. The country and network (ASN) are in the decision your code receives and in the dashboard log.

The dashboard's IP Intelligence page shows where your traffic comes from, which networks attack the most and which addresses are blocked the most.

Tor, VPNs and hosting providers: opt-in

On a sensitive route, block Tor exits (list of active exits), known commercial VPNs and browsers connecting from a hosting provider.

Real users go through a VPN to protect their privacy: these options are never on by default. Start in DRY_RUN.

What this is not

Zarex is not an IP reputation API: it does not score an address on its own; it decides for each request with the rules you chose.

In your code

A country allow list, and optionally Tor and VPN blocking.

import { withZarex, requestFilter, detectBot } from "@zarex/next";

export const POST = withZarex(
  {
    key: process.env.ZAREX_KEY!,
    ipSource: "vercel",
    rules: [
      // Service ouvert dans quatre pays : le reste est refusé.
      requestFilter({
        default: "DENY",
        conditions: [
          { field: "ip.country", operator: "IN", values: ["FR", "BE", "CH", "CA"], action: "ALLOW" },
        ],
      }),
      // En option : sorties Tor et VPN commerciaux.
      detectBot({ deny: ["CATEGORY:TOR", "CATEGORY:VPN"] }),
    ],
  },
  async (request) => Response.json({ ok: true })
);

Ready for production

Local address database

No call to a third party.

In every decision

Country and network, in code and dashboard.

Opt-in, never default

Tor, VPNs, hosting providers.

DRY_RUN

Measure the effect before enforcing.

Other protections

Start by observing

Turn the rule on in DRY_RUN, watch the log, then switch to LIVE. A question before you start? Write to us.