What are the CDN defaults?
- Static files are cached by all Regions for 31 days by default. If you need to configure this duration, you can set a
Cache-Controlheader in yournow.jsonfile. - Dynamic responses (from Serverless Functions) are not cached unless they contain a
Cache-Controlheader with specific directives (e.g.s-maxage). - Read more about this in the caching documentation.
How can I control the CDN and what caching headers (and values) it accepts?
- Your Serverless Functions have total control on how the CDN caches your responses using the
Cache-Controlheader.
What if I have an existing CDN like Akamai, Fastly, Cloudflare?
The transition is painless. All you have to do is point your NS records to our DNS infrastructure.
How do I purge the CDN cache?
- You can create a new deployment to invalidate the cache for your preview and production deployments.
- Content will remain cached for preview URLs until it expires.
What are the limits of the CDN cache?
- You can find caching limits in the caching documentation.
Can I run the CDN logic on my local development machine?
now devallows you to run your applications locally just like it does in production, but make sure to install your project's dependencies first.
How exactly does stale-while-revalidate work for the first and subsequent requests?
- The very first request is served synchronously.
- Subsequent requests are served from cache, and if stale, revalidated asynchronously in the background.
- Read more in the
stale-while-revalidatedocumentation.
What is the relation between the seconds on s-maxage and stale-while-revalidate ?
s-maxageis the number of seconds a response is considered "fresh" by the CDN.- After this period ends, the CDN will continue to serve the response from the edge but it's now considered "stale" so it will be requested again to your Serverless Function in the background to get a "fresh" one.
Is my browser aware of stale-while-revalidate? Should I expect content-flash if yes?
- We strip the
stale-while-revalidatedirective from yourCache-Controlso browsers don't get it. - This allows you to always deliver the latest content to your visitors right after creating a new deployment (as opposed to waiting for browser cache to expire).
Can I redirect users to a specific Region?
- Users who visit your deployments will automatically use the CDN Region that is geographically closest to them.
What locations do the CDN cache in?
- You can find the full list of regions in the regions and providers documentation.
Do I get billed for CDN traffic?
- On the Hobby plan there is no charge for bandwidth.
- See our pricing page for more details.
What if there is a DDoS? Will we get charged for the CDN traffic?
- In the event of a DDoS we have measures in place to detect and mitigate bad actors.
Is there any image optimization service on your CDN?
- We don't currently have an image optimization service in place, if you'd like to see this feature then please let us know.
How do I use Cloudflare over your CDN (disable it)?
- Use
Origin Control: Offalong with other custom caching rules in Cloudflare, in anow.jsonfile, sets-maxageto 0 on your routes to disable any caching from ZEIT CDN. - When a new deployment is made, you will have to find a way to purge the Cloudflare cache.