Auth gate
Read the session cookie. Redirect signed-out users away from protected paths and signed-in users away from /login.
Geolocation routing
Vercel exposes request.geo with country / region / city. Redirect to a locale-specific path on first hit.
A/B test bucketing
Set a cookie on first visit picking a variant. Subsequent requests read the cookie and route accordingly. The bucket survives navigation without server state.
Header rewriting
Add security headers, request IDs, or feature-flag headers that downstream code can read.
Use Proxy only when the decision depends on the incoming request before route selection, such as a locale cookie or experiment bucket. Make the rule deterministic, persist any bucket, and define what happens when the cookie or geolocation signal is absent. Authentication redirects, geo routing, and experiments look similar because all can redirect, but their authority differs. A proxy can improve navigation; it cannot prove ownership, turn an unreliable location hint into truth, or replace server-side experiment analysis.
Test first visit, repeat visit, missing cookie, malformed cookie, bot request, and an excluded static path. Verify that the chosen variant remains stable and that protected data rejects unauthorized access even when the proxy is bypassed.