-
Notifications
You must be signed in to change notification settings - Fork 5.9k
service-worker script wont load from non-root path #670
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
Comments
I was messing with this. The problem is going to be the scope also. I think |
Ah, there are some consequences here with the stuff generated in the manifests, etc. I am not sure if they are using workbox, but that can take care of some madness, but I think it introduces other madness =) |
Just want to chime in that I'm hitting this as well. I'm trying to run coder on Kubernetes behind a reverse proxy. It would be great to get this fixed. |
cc @code-asher |
@lucacasonato as well |
I would add a --root flag and then make that the scope and the root path for all assets including the service worker. |
The problem is you might not know what the mount point is when the server is started. I was trying to play games with |
A "--root" flag would work in our (Kubeflow)'s use case. We know the root path on which we will be serving it. /cc @aronchick |
@geiseri what issues did you encountered while working on this? The simple Paths from the manifest and links to assets inside the
I would love to see a solution without another CLI-option. The IDE shouldn't care about where it is mounted. |
Actually, the register worked, it was the resulting CSP issues that popped up later. I got around some with making workbox local vs hosted on the CDN. I will PR that part while I work out a better solution on the CSP. |
I opene #768 since I couldn't find this. Is it possible to add more tags here like reverse-proxy, ingress, kubernetes? |
code-server
version: 1.939-vsc1.33.1Description
We are running
code-server
behind a reverse proxy that uses paths instead of distinct domains. e.g.domain.com/ide/123456
. The service-worker script introduced in #154 will try to load the script fromdomain.com/service-worker.js
instead ofdomain.com/ide/123456/service-worker.js
.It should be sufficient(it's not) to remove the leading slash innavigator.serviceWorker.register("/service-worker.js");
. So eithernavigator.serviceWorker.register("./service-worker.js");
ornavigator.serviceWorker.register("service-worker.js");
. But I haven't tested all scenarios, yet.The text was updated successfully, but these errors were encountered: