DEV Community

Ogasawara Kakeru
Ogasawara Kakeru

Posted on

Vercel ~How requests flow through Vercel~

How Vercel caches static and dynamic content

Most applications serve a mix of static and dynamic content. For static assets, pre-rendered pages and cacheable responses, the proxy checks the Vercel Cache.

Cache status What happens
Hit Content is returned immediately from the Vercel region closest to the user.
Miss Content is generated in real time and stored in the cache for future requests.
Stale hit (ISR) Stale content is served instantly while fresh content is regenerated in the background.

When a request arrives, the cache is in one of these three states:

  1. Hit: The cache holds valid content, which is returned immediately.
  2. Miss: The content is not in the cache. It is generated on the spot, returned, and stored in the cache. Only this first request is slightly slower.
  3. Stale hit (ISR): The content is in the cache but has expired. The old version is returned first while a new one is regenerated in the background, so subsequent requests get the fresh content.

The third state applies only to pages that use ISR. Without ISR, there are effectively just two states: hit and miss.

With Incremental Static Regeneration (ISR), the cache serves the existing version right away and triggers regeneration in the background, so the next visitor gets the fresh version. Caching behavior can be controlled with HTTP cache headers.

Overview of the whole page

The page walks through what happens from the moment a user presses Enter to when the application appears on screen.

  1. Entering the network: DNS resolves to a Vercel anycast IP. A global load balancer sends the request to the best of 100+ Points of Presence (PoPs), considering hops, round-trip time and bandwidth. From there it travels over a private fiber backbone, which lowers latency, jitter and packet loss.
  2. Security:
    • TLS termination: Decrypts HTTPS, pools connections for slow clients, and blocks requests flagged as malicious.
    • System DDoS mitigation: Always on for all deployments. It analyzes traffic in real time, blocks L3/L4/L7 threats near the source, and has a P99 time-to-mitigation of 3.5 seconds for novel attacks.
    • WAF: Optional custom rules for application-specific protection.
  3. Proxy routing: The application-aware proxy consults globally replicated deployment metadata (from vercel.json or the framework config) to decide the route type (static file or dynamic function), apply rewrites and redirects, and run Routing Middleware (e.g. authentication, A/B testing).
  4. Caching: See the section above.
  5. Server-side code: Dynamic requests go to the Compute Layer. The Vercel Functions router manages concurrency and queues traffic during spikes. A compute instance (which can handle multiple concurrent requests with Fluid compute) runs the code and returns HTML or JSON. If the headers allow it, the proxy caches the response.
  6. Build and deploy: On push, Vercel detects the framework, runs the build, and splits the output into static assets (sent to the cache) and compute artifacts (sent to the function store). It also compiles the configuration into the metadata that drives the proxy.

Top comments (0)