-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Service Workers #25
Comments
Hey, apologies for the late reply. I have been on vacation 🏖 This sound reasonable. I didn't know |
oh, no worries! Hope you had a great time! :)
I was thinking about something along the lines of:
or something like that. I know you can come up with a clever idea on how to configure that header per service-worker path. Thank you very much and keep up with the good work! It's much appreciated |
Humm, that seems a little more involved.. would putting it on every request break the site or service worker? |
It will not break anything, I think. That header is there only to tell the browser how to setup the service worker. There is only one real problem I see, that is you can have multiple service workers on a site (with a unique scope each). If you just spit that header out on every request, It'll be impossibile for the developer to customize multiple service workers behaviour. |
Ok, do you think a service worker file naming convention (like |
I think it will. But how do you customize the value of that header per service worker served? |
This isn't really something I have looked into too deeply.. perhaps you could point me in the right direction of some good examples/documentation for this kind of setup? |
Ok, no problem. Google made a nice guide to how service workers work. In the introduction they also mention the header (it's a very simple thing once you got the basics of how they need to be configured), but the link points to the spec here: |
So.. yesterday I tried adding a service worker to a site I was developing on using servor and it seemed to work just fine.. what issue were/are you actually experiencing? |
Try to add a service worker file in a subfolder and try to give it It shouldn't work because the scope of a service worker MUST be of the same folder hierarchy or lower. If your service worker file resides in a subfolder, it cannot handle calls that originate from scripts that reside in a higher folder hierarchy (let's say root, for example) |
Ahhh.. I see! That makes sense. I have never had more than one service worker or wanted them to have different scopes. Seems like it would be hard to input that kind of config on CLI 🤔 |
I see. What do you think about the sample configuration I come up with in my second comment Do you think it's doable as a starter? Just to have such functionality? Thank you for your time ;) |
I think you could almost definitely set this up in a fork! Check out this PR which adds cors headers https://github.com/lukejacksonn/servor/pull/3/files it might give you some clues as where to get started. |
Hey @flasaracina did you figure out a nice solution to this issue? I am going to close here as it has been inactive for a while and I still haven't come across any issues with service workers myself (probably because I am just using them at the root of my project). Happy to discuss again though if you have found a nice workaround! |
Hello!
I am using servor for a web application I am building and I was wondering if there is an option to set up the
service-worker-allowed
for the site service worker.Thanks in advance
The text was updated successfully, but these errors were encountered: