Skip to content
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

Extensions using web views not working with self signed certificate #5671

Open
4 tasks done
jneuhauser opened this issue Oct 19, 2022 · 11 comments
Open
4 tasks done

Extensions using web views not working with self signed certificate #5671

jneuhauser opened this issue Oct 19, 2022 · 11 comments
Labels
waiting-for-info Waiting for more information from submitter

Comments

@jneuhauser
Copy link

jneuhauser commented Oct 19, 2022

Examples of functionality that uses web views:

  • Markdown preview
  • SQL browser

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.

@jneuhauser jneuhauser added bug Something isn't working triage This issue needs to be triaged by a maintainer labels Oct 19, 2022
@jsjoeio
Copy link
Contributor

jsjoeio commented Oct 19, 2022

@code-asher is this something we can fix or is this an issue outside code-server? I can't tell

@jsjoeio jsjoeio added waiting-for-info Waiting for more information from submitter and removed bug Something isn't working triage This issue needs to be triaged by a maintainer labels Oct 19, 2022
@code-asher
Copy link
Member

code-asher commented Oct 20, 2022 via email

@code-asher
Copy link
Member

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.

@jsjoeio
Copy link
Contributor

jsjoeio commented 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.

Yeah that might be a good move overall. It would lead to less frustration IMO.

@neurorepro
Copy link

Hello, this is actually happening for all the extensions I use and tested: Markdown preview, git history, git graph, and another one i can't remember.

These extensions are essential in my case (course based on code server, which i find super useful) so any solution on how to fix this problem would be very helpful.

Meanwhile even a code server version someone could rollback too (for which extensions are working) could be useful for those facing this case i believe

@code-asher
Copy link
Member

code-asher commented Oct 24, 2022 via email

@neurorepro
Copy link

So what would be the steps to do for a server once it is configured with Let's Encrypt? Just set yes to use cert in code server configuration file ? Anything else ?

@code-asher
Copy link
Member

code-asher commented Oct 24, 2022 via email

@jneuhauser
Copy link
Author

jneuhauser commented Oct 25, 2022

Thanks for your inputs.

So to use code-server with working service workers we need a trusted certificate?
Is it possible to get service workers working with http on chrome?

@code-asher
Copy link
Member

code-asher commented Oct 27, 2022 via email

@jneuhauser
Copy link
Author

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?

@code-asher code-asher changed the title [Bug]: Markdown preview not working with self signed certificate (SecurityError) Extensions using web views not working with self signed certificate May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-for-info Waiting for more information from submitter
Projects
None yet
Development

No branches or pull requests

4 participants