product
Compute

Middleware

Run code before a request is processed. Modify headers, rewrite paths, or implement authentication logic at the edge with sub-millisecond latency. Optimize delivery without touching your origin.

Technical Specifications:

Execution Time

Sub-1ms

Runtime

Edge Light (V8)

Latency Added

< 2ms

Capabilities

Headers, Rewrites, Cookies

Scaling

Instant & Automatic

Works seamlessly with:

Example 1

Example 2

Example 3

alt_route

Product Capabilities

speed

Zero Latency

Execute logic before the cache without adding perceptible latency to the request.

cookies

Dynamic Routing

Rewrite paths and redirect users based on headers

security

Bot Protection

Identify and block automated traffic at the edge before it hits your origin.

Experience

Logic at the Edge

Intercept requests before they hit your cache or origin. Perform authentication, A/B testing, or geo-routing instantly.

  1. Import the 'next' helper from the edge SDK.
  2. Check the request properties, such as the user's country code.
  3. Rewrite the URL path to a localized version based on the geography.

Frequently
bought together

functions

Edge Functions

Deploy serverless code that runs closer to your users. Zero cold starts, instant scaling, and support for JavaScript, TypeScript, and WebAssembly. Perfect for dynamic rendering and API routes.

monitoring

Edge Analytics

Understand your audience with privacy-first analytics. Track page views, unique visitors, and Core Web Vitals directly from the edge, without impacting client-side performance.

Ready to scale?
Start building
at the edge.

We use cookies to improve your experience.