File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,18 @@ importScripts(`${baseurl}/assets/js/data/swconf.js`);
5
5
const purge = swconf . purge ;
6
6
7
7
function verifyUrl ( url ) {
8
- const requestPath = new URL ( url ) . pathname ;
8
+ const requestUrl = new URL ( url ) ;
9
+ const requestPath = requestUrl . pathname ;
10
+
11
+ if ( ! requestUrl . protocol . startsWith ( 'http' ) ) {
12
+ return false ;
13
+ }
14
+
15
+ for ( const denyUrl of swconf . denyUrls ) {
16
+ if ( requestUrl . href . startsWith ( denyUrl ) ) {
17
+ return false ;
18
+ }
19
+ }
9
20
10
21
for ( const path of swconf . denyPaths ) {
11
22
if ( requestPath . startsWith ( path ) ) {
Original file line number Diff line number Diff line change @@ -22,6 +22,13 @@ const swconf = {
22
22
{ % endfor % }
23
23
] ,
24
24
25
+ { % - comment - % } The request url starting with below part will not be cached . { % - endcomment - % }
26
+ denyUrls : [
27
+ { % if site . analytics . goatcounter . id != nil and site . pageviews . provider == 'goatcounter' % }
28
+ 'https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/'
29
+ { % endif % }
30
+ ] ,
31
+
25
32
{ % - comment - % } The request url with below path will not be cached . { % - endcomment - % }
26
33
denyPaths : [
27
34
{ % for path in site . pwa . cache . deny_paths % }
You can’t perform that action at this time.
0 commit comments