All Topics
All Topics
Technology
Technology
AI
AI
Business
Business
Entertainment
Entertainment
News
News
Programming
Programming
Security
Security
Science
Science
Design
Design
Environment
Environment
Finance
Finance
Crypto
Crypto
Politics
Politics
Sports
Sports
Education
Education
Gaming
Gaming
Art
Art
Music
Music
Health
Health
Books
Books
Food
Food
Travel
Travel
Personal
Personal
Bluesky
Twitter

Workers - Workers fetch requests now support cf.vary

6d ago

Source

CloudflareWorkers - Workers fetch requests now support cf.varycloudflare.com
Snippet from the RSS feed
Workers 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

Comments

Sign in to join the conversation.

No comments yet. Be the first.