[Bug]: Markdown preview not working with self signed certificate (SecurityError)
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
OS/Web Information
- Web Browser: Chrome Version 106.0.5249.119 (Offizieller Build) (64-Bit)
- Local OS: Windows 10 21H1
- Remote OS: Debian 11
- Remote Architecture: amd64
code-server --version
: 4.7.0
Steps to Reproduce
- start code-server with
cert: true
inconfig.json
https://coder.com/docs/code-server/latest/guide#using-a-self-signed-certificate - open code-server with https://IP:PORT
- accept self signed certificate
- open or create a *.md file
- Hit the preview button on the top right
Expected
The preview of the Markdown document should be shown.
Actual
The preview windows remains empty.
Logs
code-server --verbose Nothing that is related to this error/bug.
Code-Server Webview
Error loading webview: Error: Could not register service workers: SecurityError: Failed to register a ServiceWorker for scope ('https://192.168.107.129:8080/stable-784b0177c56c607789f9638da7b6bf3230d47a8c/static/out/vs/workbench/contrib/webview/browser/pre/') with script ('https://192.168.107.129:8080/stable-784b0177c56c607789f9638da7b6bf3230d47a8c/static/out/vs/workbench/contrib/webview/browser/pre/service-worker.js?v=4&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&remoteAuthority=192.168.107.129:8080'): An SSL certificate error occurred when fetching the script..
Screenshot/Video
Does this issue happen in VS Code or GitHub Codespaces?
- I cannot reproduce this in VS Code.
- I cannot reproduce this in GitHub Codespaces.
Are you accessing code-server over HTTPS?
- I am using HTTPS.
Notes
This happens only on my local deployment with the self signed certificate. My external deployment with a lets encrypt certificate does work as expected.
Issue Analytics
- State:
- Created a year ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
[Bug]: Webview error · Issue #5338 · coder/code-server · GitHub
net&remoteAuthority=localhost:8080'): An SSL certificate error occurred when fetching the script. ... Markdown Preview is not working #4421.
Read more >Certificate error when using HTTPS proxy with self-signed ...
It supports self-signed certificates without proxy or proxy with normal CA certificates, but not the combination of proxy + self-signed. In ...
Read more >Exception dialog needs to support cert with domain name or ...
So, basically with this bug and bug 405289 I'd like to be able to work with ... But in the case that failed,...
Read more >Resolving SSL Self-Signed Certificate Errors
If you're using a self-signed certificate on your Bitbucket server ... SSL certificate problem: self signed certificate in certificate chain ...
Read more >Fix list for IBM WebSphere Application Server traditional V9
Plug-in, PH46638, Server markdown and retry when 505 is received instead of 100-continue ... PH46142, Qop settings page does not work for daemon...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you very much… I’ve defined
http://192.168.107.129:8080
as secure origin inchrome://flags/#unsafely-treat-insecure-origin-as-secure
and it works. 😃 Using the auto generated self signed cert (cert: true
) and defininghttps://192.168.107.129:8080
(https Instead of http) does not work.So to sum up what makes service workers work is:
code-server --cert /path/to/cert.crt --cert-key /path/to/key.pem
localhost
/127.0.0.1
localhost
/127.0.0.1
localhost
/127.0.0.1
https://github.com/coder/code-server/blob/main/docs/guide.md#port-forwarding-via-sshhttp://192.168.107.129:8080
) as secure origin. HTTPS-URLs may not work!chrome://flags/#unsafely-treat-insecure-origin-as-secure
Can/Should we close this issue or should i leave it open till anyone updates the documentation?
In the docs we recommend mkcert. Wonder if we can deprecate code-server’s built-in certificate generator for that or at least add a warning to the output.