Maximum protection: how a route works (for developers)
The protocol a route on your own domain follows, the Install API, and how to test it. For developers who build or check a route themselves.
Maximum protection (Pro and Plus) adds a route on your own domain, for example https://example.com/maple/k7q2/. The route passes visitors' requests on to AdCobalt. By default it is a backup: visitors load AdCobalt from our address as usual, and through your route only when our address is blocked for them. With Always use my domain, every visitor goes through the route.
Ready-made routes for a Cloudflare Worker, a PHP file and nginx or Apache are in the dashboard, with step-by-step help in Maximum protection: set up your route; a WordPress plugin follows. This article describes what every route does, for developers who build or check a route themselves.
What you need
You find everything on the Install tab of any website, under Maximum Protection Setup:
- your route path (for example
/maple/k7q2/), the same for all your websites, - your install key (starts with
rk_), shown once when you create it, - the Maximum code, which replaces the standard code on your pages.
Keep the install key on your server only. Never put it into a page, a script that visitors download, or a public repository.
What the route does
Every request to <path><rest> on your website goes to https://adcobalt.com/<rest>, with the same method (GET, HEAD, POST or OPTIONS), the same query string and, for POST, the same body. The route adds four headers:
X-Route-Key: your install key.X-Route-Client-IP: the visitor's IP address, as your server sees it.X-Route-Host: your website's hostname (for exampleexample.com). It must be one of the websites in your account.X-Route-Country(optional): the visitor's country as two letters, if your server knows it (for example from Cloudflare).
The route removes the visitor's cookies before passing a request on, and passes our answer back unchanged, except for any Set-Cookie header. It should allow at least 6 seconds for our answer.
Without a valid key, or for a hostname that is not in your account, we refuse the request. We trust the forwarded IP address and country only together with a valid key.
Install API
These addresses need only the X-Route-Key header:
| Address | What it returns |
|---|---|
GET https://adcobalt.com/api/route/v1/settings | Your route path, a previous path that still works (for 7 days after you choose a new one), the script's file name and version, and whether "Always use my domain" is on. Refresh it about once an hour. |
GET https://adcobalt.com/api/route/v1/script | The current script. A route may keep a copy for up to one hour (it is sent with Cache-Control: public, max-age=3600). |
GET https://adcobalt.com/api/route/v1/health | A health check. Through the route, <path>health reaches the same check. |
Test my route
Test my route on the Install tab calls https://<your website><path>health from our server. The route passes it on to us with your key, and our answer must come back through it. You see a green tick, or one of these reasons:
- We couldn't reach your website: the website is offline or its address doesn't resolve.
- Took too long: no answer within 6 seconds.
- Nothing answers at your route path: the route is not installed, or under another path.
- Wrong key: the route sends an old key, a mistyped key or another account's key.
- Wrong website address:
X-Route-Hostis not one of your websites.
We also check each route once a day and tell you once (in the dashboard and by email) if a route that worked stops answering.
Changing the key or the path
Create a New Key gives you a new install key; the old one stops working at once, so paste the new one wherever you used it. New path gives you a new route path; the old one keeps working for 7 days, and the settings list it under previous paths. Both changes are recorded in your account's activity log, without the key itself.
Still stuck? Sign in and use Help & Support: it checks your setup and you can write to us from there.
Get help in your dashboard