Workers - Workers fetch requests now support cf.vary
6d ago
Source
CloudflareWorkers - Workers fetch requests now support cf.varycloudflare.comWorkers fetch() requests now support the cf.vary request option. Use cf.vary to control how Cloudflare caches origin responses with a Vary header for a single subrequest. JavaScript export default { async fetch ( request ) { return fetch ( request , { cf : { vary : { default : { action : "bypass" }, headers : { accept : { action : "normalize" , media_types : [ "text/html" , "application/json" ] , }, "accept-language" : { action : "normalize" , languages : [ "en" , "fr" , "de" ] , }, }, }, }, } ) ; }, }; TypeScript export default { async fetch ( request ) : Promise < Response > { return fetch ( request , { cf : { vary : { default : { action : "bypass" }, headers : { accept : { action : "normalize" , media_types : [ "text/html" , "application/json" ] , }, "accept-language" : { action : "normalize" , languages : [ "en" , "fr" , "de" ] , }, }, }, }, } ) ; }, } satisfies ExportedHandler ; For more information, refer to cf.vary .
You might also wanna read
Cloudflare Addresses CPU Performance Benchmarks for Workers Platform
Cloudflare investigated and responded to independent benchmarks by Theo Browne that showed Cloudflare Workers performing 3.5x slower than Ve
OpenWorkers: Open-Source Runtime for Self-Hosted Cloudflare Workers Implementation
OpenWorkers is an open-source runtime that enables developers to run Cloudflare Workers-style JavaScript applications on their own infrastru

Comments
Sign in to join the conversation.
No comments yet. Be the first.