question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: Markdown preview not working with self signed certificate (SecurityError)

See original GitHub issue

Is 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

  1. start code-server with cert: true in config.json https://coder.com/docs/code-server/latest/guide#using-a-self-signed-certificate
  2. open code-server with https://IP:PORT
  3. accept self signed certificate
  4. open or create a *.md file
  5. 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

code-server

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:open
  • Created a year ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
jneuhausercommented, Oct 28, 2022

Thank you very much… I’ve defined http://192.168.107.129:8080 as secure origin in chrome://flags/#unsafely-treat-insecure-origin-as-secure and it works. 😃 Using the auto generated self signed cert (cert: true) and defining https://192.168.107.129:8080 (https Instead of http) does not work.

So to sum up what makes service workers work is:

Can/Should we close this issue or should i leave it open till anyone updates the documentation?

2reactions
code-ashercommented, Oct 20, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found