Requests made from Cloudflare Workers can now force a revalidation of their cache with the origin.
By setting the value of the cache
property to no-cache
, you can force Cloudflare's
cache to revalidate, its contents with the origin when
making subrequests from Cloudflare Workers.
export default { async fetch(req, env, ctx) { const request = new Request("https://cloudflare.com", { cache: "no-cache", }); const response = await fetch(request); return response; },};
export default { async fetch(req, env, ctx): Promise<Response> { const request = new Request("https://cloudflare.com", { cache: 'no-cache'}); const response = await fetch(request); return response; }} satisfies ExportedHandler<Environment>
When you set the value to no-cache
on a subrequest made from a Worker, the Cloudflare Workers
runtime will force the cache to revalidate its data with the origin
This increases compatibility with NPM packages and JavaScript frameworks that rely on setting the
cache
property, which is a cross-platform standard part
of the Request
interface. Previously, if you set the cache
property on Request
to 'no-cache'
, the Workers runtime threw an exception.
- Learn how the Cache works with Cloudflare Workers
- Enable Node.js compatibility for your Cloudflare Worker
- Explore Runtime APIs and Bindings available in Cloudflare Workers
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- © 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark