Reputation: 4732
I have a webapp that is running with angular and it has a running service worker. Whenever I perform a PUT and GET operations on s3.amazonaws.com the request is always made from a service worker.
What configuration can use to make my request that is going to and from s3.amazonaws.com to be ignored by service worker?
Here is my nsgw-config.json
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**"
]
}
}
]
}
Upvotes: 0
Views: 978
Reputation: 780
if you want to prevent duplicate service worker call then please do few steps as below.
onFetch(event) {
function modify the onfetch function like below
onFetch(event) {
/* sub domain URL here and subdomain ajax all domain here.*/
var blackListDomain=["www.xyz.com/api","www.abc.com/v2/api"];
for (var i = 0; i < blackListDomain.length; i++) {
if (event.request.url.indexOf(blackListDomain[i])>-1) {
console.log("revent " + event.request.url);
return;
}
}
Hint
Upvotes: 1