Smart Routing is the orchestration engine behind every NearNode scan. Instead of a static redirect, each node evaluates a priority-ordered rule stack at the edge and routes the user to the first matching destination.
If no rule matches, the node’s base payload is used as a fallback.
Ops Tip: You can manage routing rules visually in the Dashboard under each node’s “Rules” tab — no API calls required.
Rule Types
Time-Based
A/B Split
Geo
Device
Route based on time of day and day of week. Deploy time-sensitive destinations without touching your infrastructure. {
"rule_type" : "time_based" ,
"conditions" : {
"timezone" : "Europe/Zurich" ,
"windows" : [
{
"days" : [ 1 , 2 , 3 , 4 , 5 ],
"start_time" : "08:00" ,
"end_time" : "18:00"
}
]
},
"function_type" : "redirect" ,
"payload" : { "url" : "https://acme.com/open" }
}
Use case: A restaurant QR code routes to the lunch menu from 11:00–14:00 and the dinner menu from 18:00–22:00.Split traffic by percentage between variants. Run controlled experiments on physical assets. {
"rule_type" : "ab_split" ,
"conditions" : {
"variant" : "A" ,
"weight" : 50
},
"function_type" : "redirect" ,
"payload" : { "url" : "https://acme.com/page-a" }
}
Create one rule per variant. Weights across all variants for a node must sum to 100. Traffic distribution is non-deterministic per request.
Route based on the scanner’s country, detected via Vercel’s edge headers at sub-millisecond latency. {
"rule_type" : "geo" ,
"conditions" : {
"countries" : [ "CH" , "DE" , "AT" ],
"match_type" : "include"
},
"function_type" : "redirect" ,
"payload" : { "url" : "https://acme.com/dach" }
}
Use case: Show German content to users scanning in the DACH region, English everywhere else.Route based on device type — mobile, desktop, or tablet. {
"rule_type" : "device" ,
"conditions" : {
"devices" : [ "mobile" ],
"match_type" : "include"
},
"function_type" : "redirect" ,
"payload" : { "url" : "https://acme.com/mobile-app" }
}
Use case: Send Android/iOS users to the App Store and desktop users to the web app.
Priority & Evaluation
Rules are evaluated in ascending priority order (lower number = higher priority). The first matching rule wins — remaining rules are skipped.
Priority 0: Time-based → Office hours redirect
Priority 1: Geo → DACH region redirect
Priority 2: Device → Mobile app redirect
Priority 3: Default → Base payload (fallback)
Performance: Rule evaluation adds less than 150ms to the edge response. Total TTFB with routing rules stays under 350ms globally.
Creating Rules via API
curl -X POST https://nearnode.io/api/v1/nodes/k9m2xp4q/rules \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"label": "Office Hours",
"priority": 0,
"rule_type": "time_based",
"conditions": {
"timezone": "Europe/Zurich",
"windows": [{ "days": [1,2,3,4,5], "start_time": "08:00", "end_time": "18:00" }]
},
"function_type": "redirect",
"payload": { "url": "https://acme.com/welcome" }
}'
Payload Types
Each routing rule can target any supported payload type:
Type Description redirectHTTP 307 redirect to a URL vcardGenerate and serve a vCard download wifiWiFi provisioning page (SSID, password, encryption) actionDirect-to-action: WhatsApp, Calendly, email, phone micrositeHosted microsite with custom content