Skip to content

Commit d1a362a

Browse files
committed
Reduce CORS preflight cache time from 24h to 5min
Changed Access-Control-Max-Age from 86400s (24 hours) to 300s (5 minutes). This allows faster recovery when CORS issues occur with preview deployments, while still providing caching benefits to reduce OPTIONS requests. Fixes issue where preview deployments couldn't access the worker proxy unless in a private session due to cached CORS failures.
1 parent b41defc commit d1a362a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cloudflare-worker/worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ function handleCorsPreflight(request) {
197197
...getCorsHeaders(request),
198198
'Access-Control-Allow-Methods': 'GET, OPTIONS',
199199
'Access-Control-Allow-Headers': 'Content-Type',
200-
'Access-Control-Max-Age': '86400',
200+
'Access-Control-Max-Age': '300', // 5 minutes - allows quick recovery from CORS issues
201201
},
202202
});
203203
}

0 commit comments

Comments
 (0)