File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ const BLACKLIST = [
1616 "monu.delivery" ,
1717 "www.google-analytics.com" ,
1818 "cognito-identity.us-west-2.amazonaws.com" ,
19- "dynamodb.us-west-2.amazonaws.com"
19+ "dynamodb.us-west-2.amazonaws.com" ,
20+ "googletagmanager.com"
2021 // Note: removed amazonaws.com from blacklist since you have AWS domains in servers.txt
2122] ;
2223
@@ -308,21 +309,21 @@ function getFileType(url) {
308309}
309310
310311// Main fetch event handler
311- self . addEventListener ( 'fetch' , event => {
312+ self . addEventListener ( 'fetch' , async event => {
312313 // Only handle GET requests
313314 if ( event . request . method !== 'GET' ) return ;
314315
315316 const request = event . request ;
317+ const isCacheable = await isCacheableRequest ( request ) ;
316318
319+ if ( ! isCacheable ) {
320+ // Let non-cacheable requests pass through
321+ return ;
322+ }
317323 event . respondWith (
318324 ( async ( ) => {
319325 // Check if request is cacheable
320- const isCacheable = await isCacheableRequest ( request ) ;
321326
322- if ( ! isCacheable ) {
323- // Let non-cacheable requests pass through
324- return fetch ( request ) ;
325- }
326327
327328 const url = new URL ( request . url ) ;
328329 const fileType = getFileType ( url ) ;
You can’t perform that action at this time.
0 commit comments