我有一个工作人员,我想在 URL 以这种方式具有特定参数时绕过缓存:
let wcApiParam = url.searchParams.get('wc-api');
//bypass cache if wc-api param is in the URL
if( wcApiParam != 'auth' ){
//force cache
response = await fetch( newRequest, { cf: { cacheTtl: 43200 } } );
} else {
//bypass cache
response = await fetch( newRequest, { cf: { cacheTtl: 0 } } );
}
我不确定我做错了什么,请求的响应总是302 (from disk cache)
这会导致我的站点出现错误,因为我需要避免这些请求被缓存。我的工人可能有什么问题?或者我的缓存设置有问题?
以下是完整回复: