0
votes

I have setup service worker in my angular site. I have the ngsw-config.json. Now I'm using it to cache and prefetch somestuff. But I want this service worker to block requests to domains other than mine. Since I crawl documents from internet and put it in my site, it could send resources and ajax requests to those domains. I dont want that to happen.

I know I can achieve this with service worker in plain JS as given here. But I wanna do it the angular way. Can angular service worker help me out here?

1

1 Answers

0
votes

Use angular httpinterceptor.

It's a very nice feature of Angular where you can manipulate the request and response as per your business requirement....

Please follow the below link for more details on this...

https://angular.io/api/common/http/HttpInterceptor