Provision to host service worker file to publisher's host url (root folder)

Hello Team,

We have specific requirement where our extension wants to put serviceworker.js file on the root directory of publisher’s (who is using our extension) hosting server. Since this is browser limitation that service worker should be served from same host where website is geting hosted. It is mandatory for our extension to place this file on publishers host so that it can be installed though extension.

Please suggest some solution.

Thanks

To check service worker file hosting on different path - Proxy URLs | Fynd Partners Help Center
javascript - Understanding Service Worker scope - Stack Overflow