You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue is similar to #296 The fix in this issue is not applicable to me I think since I'm not running behind nginx.
Web Browser: Google Chrome
Local OS: Windows 10
Remote OS: Ubuntu 20.04
Steps to Reproduce
Open any md file.
Try previewing the document.
Nothing in the code-server logs, But on dev tools,
Uncaught(inpromise) Error: ServiceWorkersarenotenabled.Webviewswillnotwork.Trydisablingprivate/incognitomode.atmain.js:115atnewPromise(<anonymous>)
at main.js:115
I'm going to close this since this is related to your environment but feel free to open a Discussion if you need more help or have a question about enabling HTTPS. See the docs here for more info.
Hi @jsjoeio I tried serving it with the --link for it to be served in HTTPS, however the preview is still not working.
I get a new error,
ERR[UriError]: IfaURIdoesnotcontainanauthoritycomponent,thenthepathcannotbeginwithtwoslashcharacters("//"): Error: [UriError]: IfaURIdoesnotcontainanauthoritycomponent,thenthepathcannotbeginwithtwoslashcharacters("//")atb(https://benjcabalona-benjcabalona1029.cdr.co/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.js:70:77397)atnewp(https://benjcabalona-benjcabalona1029.cdr.co/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.js:70:78038)atnewm(https://benjcabalona-benjcabalona1029.cdr.co/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.js:70:79686)atFunction.from(https://benjcabalona-benjcabalona1029.cdr.co/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.js:70:79103)athttps://benjcabalona-benjcabalona1029.cdr.co/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.js:1271:14766atString.replace(<anonymous>)
at _.rewriteVsCodeResourceUrls (https://benjcabalona-benjcabalona1029.cdr.co/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.js:1271:14654)
at _.set html [as html] (https://benjcabalona-benjcabalona1029.cdr.co/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.js:1271:14307)
at https://benjcabalona-benjcabalona1029.cdr.co/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.js:1226:30501
at b.withWebview (https://benjcabalona-benjcabalona1029.cdr.co/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.js:1226:31874)
Hmm quite odd indeed. The only way I can think of for the authority to
be missing is if the host header is missing but we have used link
successfully before so I am not sure.
There have been changes to the remote authority in the latest code so it
is possible it will be fixed there.
Markdown preview is also not working for me since upgrading to 4.0.1 it seems (from 3.x). I use SSH forwarding, and in the Chrome "Application" tab I see two service workers are green with status "activated and is running." Triggering markdown preview results in no new system logs or console logs, just shows "Activating Extensions..." then nothing happens.
When use http://127.0.0.1 or http://localhost code-server's markdown-preview-enhanced preview should worked fine, otherwise use http://ip markdown-preview-enhanced preview is not working.
VSCode markdown Plugin: shd101wyy.markdown-preview-enhanced
Explorer: firefox or chrome
CodeServer: v4.0.2
Hi @jsjoeio ,
I'm trying to build a react application with the code server as an iframe. The code server is served over HTTPS and when I tried to launch my react application in my local (http://localhost:3000), I don't see any issues. However, when I deploy my react application to a domain (http://my-app.com) that's when I'm getting the error that the OP posted and also a popup saying that code-server is being accessed in an insecure context. Web views, the clipboard, and other functionality may not work as expected.
Also when I try to open the code server URL from the iframe to a new tab, I don't see this issue. Do I need to host my react application in HTTPS as well?
Can you deploy it to HTTPS? I believe many services offer this for free. Other than that, there isn't much we can do since this is a browser limitation
Can you deploy it to HTTPS? I believe many services offer this for free. Other than that, there isn't much we can do since this is a browser limitation
I deployed it in HTTPS and it works as expected. Thanks @jsjoeio
@jsjoeio It worked, when I add --cert. The link worked perfectly when use safari, the only thing need to do is to trust the certificat. Chrome not worked, I turn to Chrome Canary, and start it with --ignore-certificate-errors --ignore-urlfetcher-cert-request, finally it worked.
By working properly do we mean Chrome is not letting you accept the self-signed certificate? When I try I get "your connection is not private" (as expected) then I can accept the certificate anyway by going to advanced > proceed on the page.
Ohhhhh right I remember now that Chrome started rejecting the certificate for service workers even if you accept the certificate on that page. I am not sure if there is anything we can do from code-server's side on this unfortunately. I think this is just a decision they made on the browser side so we are kinda stuck with it.
It might be wise to output some text when using --cert describing the limitations or maybe show a message in-browser if we can about the issue. Or maybe the move is to deprecate --cert and recommend something like mkcert?
Although personally to me it feels like a bug so maybe there is something upstream about it.
Activity
jsjoeio commentedon Nov 1, 2021
@benjcabalona1029 you need to enable service workers in order for the markdown preview to work. Are you serving code-server via HTTPS?
benjcabalona1029 commentedon Nov 3, 2021
@jsjoeio Thank yor for your comment. How do i enable the service workers? No, I'm not serving it in https.
jsjoeio commentedon Nov 3, 2021
There's your issue. You'll need to serve it via HTTPS and that will allow your browser to enable service workers automatically I believe.
jsjoeio commentedon Nov 3, 2021
I'm going to close this since this is related to your environment but feel free to open a Discussion if you need more help or have a question about enabling HTTPS. See the docs here for more info.
benjcabalona1029 commentedon Nov 4, 2021
Hi @jsjoeio I tried serving it with the
--linkfor it to be served in HTTPS, however the preview is still not working.I get a new error,
jsjoeio commentedon Nov 4, 2021
Uhh...I have yet to see this error 🤔 @code-asher any ideas?
code-asher commentedon Nov 10, 2021
benjcabalona1029 commentedon Nov 10, 2021
Okay, I'll try to update it once we have a new release. Can we reopen this issue? @jsjoeio
jsjoeio commentedon Nov 10, 2021
Good call! You got it
krenny commentedon Nov 11, 2021
Might be unrelated but I have seen Issues like that while using private/incognito mode.
For some odd reasons serverice workers won't start in incognito...
Edit: this seems only be true for firefox
jsjoeio commentedon Nov 12, 2021
I believe service workers are disabled in incognito in Firefox (IIRC)
austinbutler commentedon Jan 19, 2022
Markdown preview is also not working for me since upgrading to 4.0.1 it seems (from 3.x). I use SSH forwarding, and in the Chrome "Application" tab I see two service workers are green with status "activated and is running." Triggering markdown preview results in no new system logs or console logs, just shows "Activating Extensions..." then nothing happens.
Console log
Not sure if related or a new issue.
tlw-ray commentedon Feb 9, 2022
When use http://127.0.0.1 or http://localhost code-server's markdown-preview-enhanced preview should worked fine, otherwise use http://ip markdown-preview-enhanced preview is not working.
VSCode markdown Plugin: shd101wyy.markdown-preview-enhanced
Explorer: firefox or chrome
CodeServer: v4.0.2
11 remaining items
jsjoeio commentedon Feb 24, 2022
@Cleanairdreaming are you using HTTPS?
ksbalajee commentedon Jul 14, 2022
Hi @jsjoeio ,
I'm trying to build a react application with the code server as an iframe. The code server is served over HTTPS and when I tried to launch my react application in my local (http://localhost:3000), I don't see any issues. However, when I deploy my react application to a domain (http://my-app.com) that's when I'm getting the error that the OP posted and also a popup saying that
code-server is being accessed in an insecure context. Web views, the clipboard, and other functionality may not work as expected.Also when I try to open the code server URL from the iframe to a new tab, I don't see this issue. Do I need to host my react application in HTTPS as well?
code-server: v4.3.0
Code: 1.65.2
Commit: Unknown
Date: 2022-04-14T21:04:05.402Z
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
jsjoeio commentedon Jul 18, 2022
Can you deploy it to HTTPS? I believe many services offer this for free. Other than that, there isn't much we can do since this is a browser limitation
gogobd commentedon Jul 19, 2022
Maybe #5338 is related?
ksbalajee commentedon Jul 31, 2022
I deployed it in HTTPS and it works as expected. Thanks @jsjoeio
jsjoeio commentedon Aug 1, 2022
awesome! i'm going to close this for now then.
weironz commentedon Aug 4, 2022
You can config https, it's easy: https://coder.com/docs/code-server/latest/guide#using-lets-encrypt-with-caddy
gogobd commentedon Aug 4, 2022
Is it just not planned to allow code server to work properly with the certificates it creates when started with ’--cert’?
Water-Ghost commentedon Aug 4, 2022
@jsjoeio It worked, when I add
--cert. The link worked perfectly when use safari, the only thing need to do is to trust the certificat. Chrome not worked, I turn to Chrome Canary, and start it with--ignore-certificate-errors --ignore-urlfetcher-cert-request, finally it worked.gogobd commentedon Aug 4, 2022
The certs are being created with mkcert i wonder if chrome starts to work if you install mkcert on your host system?
code-asher commentedon Aug 10, 2022
By working properly do we mean Chrome is not letting you accept the self-signed certificate? When I try I get "your connection is not private" (as expected) then I can accept the certificate anyway by going to advanced > proceed on the page.
gogobd commentedon Aug 10, 2022
When i do "advanced.../proceed..." i still get webview errors and most cool features don't work as expected :-/
code-asher commentedon Aug 10, 2022
Ohhhhh right I remember now that Chrome started rejecting the certificate for service workers even if you accept the certificate on that page. I am not sure if there is anything we can do from code-server's side on this unfortunately. I think this is just a decision they made on the browser side so we are kinda stuck with it.
It might be wise to output some text when using
--certdescribing the limitations or maybe show a message in-browser if we can about the issue. Or maybe the move is to deprecate--certand recommend something likemkcert?Although personally to me it feels like a bug so maybe there is something upstream about it.
code-asher commentedon Aug 10, 2022
Interestingly Firefox does seem to work.