Edge Function Triggers & Request Lifecycle
Understand where edge functions hook into the request lifecycle and the trigger points that let you modify requests and responses at the edge.
The Edge Request Lifecycle
When a request reaches a CDN edge, it passes through distinct phases. Edge functions can attach to specific phases to inspect or transform the request and response.
- Viewer request: as the request arrives
- Origin request: before fetching from origin
- Origin response: after origin replies
- Viewer response: before returning to the user
Viewer Request Trigger
The viewer request trigger runs on every incoming request, even cache hits. Use it for lightweight logic like redirects, header normalization, or A/B routing.
All lessons in this course
- Edge Caching for Dynamic Content
- Serverless Functions at the Edge
- Deploying Edge Functions
- Edge Function Triggers & Request Lifecycle