We've implemented a Service Worker in our Angular application. This app needs a client certificate for authentication and Single Sign on. When the Service Worker calls the authentication endpoint it's not able to send the certificate since they are in different security layers (see Sending client certificate via JavaScript. ).
We've tried to exclude that request from the service worker configuration but we haven't been able to make it work. The only workaround we have found is modifying ngsw-worker.js but this is not a valid solution in the long term:
this.scope.addEventListener('fetch', (event) => {
if (event.request.url.match('^.*(\/api\/auth\/token\/logon)$')) {
return false;
}
}
Do you know if there is any other way to skip some particular requests?
HttpInterceptorand match on the url. - Igor