How can I correctly register a service worker for my app?

VladislavD
Shopify Partner
2 0 3

I am the developer of an app for Shopify. And at this stage I am trying to run service worker through my app, for web push. In order for me to register a service worker, I need to have access to my js file in the store root (myshop.myshopify.com/sw.js ). I understand that I can't just add this file to the root of the store, and I tried to solve this problem through the app proxy, but I was disappointed because I can't use the header service-worker-allowed: / (Shopify security policy - as far as I understood).

The question is, is there a way to register service worker correctly, or some other way? Is it possible in principle to do what I want or not? I will be very grateful for any answer.

Replies 3 (3)

nathanfin
Visitor
1 0 1

Hello, I've encountered the same problem today, have you had any progress or any ideas on that issue?

HaiThai
Shopify Partner
1 0 0

What is the best approach to push service worker file to Storefront?

ELHAFIDI
Shopify Partner
3 0 0

Same, did you find any solution for this problem