Is there are way to add a custom header in JS API?

The issue is that “ngsw-bypass” header is required in Angular applications to bypass service worker.

Without the header, service worker throws this error:

ngsw-worker.js:1308 Fetch API cannot load Request mode is “no-cors” but the redirect mode is not “follow”.

Passing a query parameter would also be an option.

Moderator, please remove this question. The problem was solved by just simply appending a correct query parameter. Thank you.