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
run code-server --bind-addr 0.0.0.0:443 --cert -- /app
Connect to the address
Click an image
Expected
Image should be shown in editor
Actual
An SSL certificate error occurred when fetching the script.
log.ts:313 ERR [Service Worker] registration DOMException: Failed to register a ServiceWorker for scope ('https://--server--/') with script ('https://--server--/service-worker.js'): An SSL certificate error occurred when fetching the script.
Logs
No response
Screenshot/Video
No response
Does this issue happen in VS Code?
I cannot reproduce this in VS Code.
Are you accessing code-server over HTTPS?
I am using HTTPS.
Notes
Please note i'm running it in docker but 443 is exposed (via 8080 in my case).
@code-asher any ideas on where to troubleshoot the cause of this? I haven't spent much time generating SSL certificates locally before. I wonder what broke there.
Unfortunately not :( I've been pulled onto another project so my code-server work as slowed down this month. Hopefully soon though! PRs/help welcome though
I updated to 4.9.0 and it seems to me that the certificates that are being generated on startup are not valid for brave, it shows
after accepting the exception. Safari shows a lock sign indicating valid encryption, but it does show images. However Python Notebooks are displayed as text, but that's another issue. Is it not possible to automatically generate a certificate on startup that can be manually accepted in Chrome based browsers?
I found a way to get Brave to work on MacOS.
I used openssl s_client -connect localhost:8080 to retrieve the auto-generated (self-signed) certificate from the running code-server instance. I created a file with the extension .crt so I could import that key into Keychain Access.app. Then I used the search function in Keychain Access and double-clicked the new certificate to select "Always trust".
This enables all features other browsers don't seem to have an issue with - images are shown, Webviews seem to work ok, Jupyter Notebooks run.
This might also be an acceptable workaround for #5338 .
Reacted by Joe Previte, Chen Yaqi and Rubén Infante
Yeah if I recall correctly it will unequivocally refuse certificates it deems insecure for web workers (which are used by web views). Other browsers like Firefox are OK using it for web workers as long as you accept the initial prompt.
Activity
gogobd commentedon Jan 27, 2022
Additionally "Cannot reconnect. Please reload the window." pops up after some minutes... that's probably related.
jsjoeio commentedon Jan 27, 2022
I was able to reproduce this locally on macOS + Brave with
code-server --bind-addr 0.0.0.0:443 --cert@code-asher any ideas on where to troubleshoot the cause of this? I haven't spent much time generating SSL certificates locally before. I wonder what broke there.
enric1994 commentedon Feb 2, 2022
In the meantime, you can use version 3.9.1 if you really have to display images:
docker pull codercom/code-server:3.9.1code-asher commentedon Feb 8, 2022
Seems likely to be the same issue as #4693 (comment)
gogobd commentedon Feb 12, 2022
I updated to version 4.0.2 and this issue seems to be fixed!
enric1994 commentedon Feb 12, 2022
Still not working for me. I have the following setup:
docker-compose.yml:
config.yaml:
I access it using a tunnel (Ngrok)
gogobd commentedon Feb 13, 2022
I realised that it did work when docker was running on the same machine, but not when code server was on another machine. Reopening.
17 remaining items
gogobd commentedon Apr 19, 2022
@jsjoeio I always have to confirm that I want to accept the certificate:
After confirming the browser marks it as not secure:
I run code-sever in docker using `--cert' :
CMD ~/.local/bin/code-server --cert --bind-addr 0.0.0.0:8080 /app
jsjoeio commentedon Apr 19, 2022
Thanks for the details! That part sounds like it's working as expected 🤔 We'll have to dig into this.
gogobd commentedon May 16, 2022
I was wondering if there's any news on this...
jsjoeio commentedon May 19, 2022
Unfortunately not :( I've been pulled onto another project so my code-server work as slowed down this month. Hopefully soon though! PRs/help welcome though
benz0li commentedon Jul 21, 2022
@gogobd Have a look at mkcert for making locally-trusted development certificates.
gogobd commentedon Jul 21, 2022
This could all be the same problem, I'm using "--cert", see #5338
gogobd commentedon Dec 10, 2022
I updated to 4.9.0 and it seems to me that the certificates that are being generated on startup are not valid for brave, it shows

after accepting the exception. Safari shows a lock sign indicating valid encryption, but it does show images. However Python Notebooks are displayed as text, but that's another issue. Is it not possible to automatically generate a certificate on startup that can be manually accepted in Chrome based browsers?
jsjoeio commentedon Dec 12, 2022
I think something changed in Chromium that prevents it from accepting self-signed certificates or something 🤔
cc @code-asher do you remember where we read that?
gogobd commentedon Dec 13, 2022
I was trying to allow insecure certificates from localhost with
chrome://flags/#allow-insecure-localhostbut that didn't enable web-views.gogobd commentedon Dec 13, 2022
I found a way to get Brave to work on MacOS.
I used
openssl s_client -connect localhost:8080to retrieve the auto-generated (self-signed) certificate from the running code-server instance. I created a file with the extension.crtso I could import that key intoKeychain Access.app. Then I used the search function in Keychain Access and double-clicked the new certificate to select "Always trust".This enables all features other browsers don't seem to have an issue with - images are shown, Webviews seem to work ok, Jupyter Notebooks run.
This might also be an acceptable workaround for #5338 .
code-asher commentedon Dec 19, 2022
Yeah if I recall correctly it will unequivocally refuse certificates it deems insecure for web workers (which are used by web views). Other browsers like Firefox are OK using it for web workers as long as you accept the initial prompt.
benz0li commentedon Aug 9, 2023
@gogobd Please close the issue when it is resolved.
gogobd commentedon Aug 9, 2023
Note:
openssl s_client -connect localhost:8480 -showcerts </dev/null 2>/dev/null | sed -n '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p'shows the certificate ready to be used.