Skip to content

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

Closed

Description

@jneuhauser

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.

Activity

  1. added
    bugSomething isn't working
    triageThis issue needs to be triaged by a maintainer
    on Oct 19, 2022
  2. jsjoeio commented on Oct 19, 2022

    @jsjoeio
    Contributor

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

  3. added
    waiting-for-infoWaiting for more information from submitter
    and removed
    bugSomething isn't working
    triageThis issue needs to be triaged by a maintainer
    on Oct 19, 2022
  4. code-asher commented on Oct 20, 2022

    @code-asher
    Member
  5. code-asher commented on Oct 20, 2022

    @code-asher
    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.

  6. jsjoeio commented on Oct 20, 2022

    @jsjoeio
    Contributor

    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.

  7. neurorepro commented on Oct 22, 2022

    @neurorepro

    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

  8. code-asher commented on Oct 24, 2022

    @code-asher
    Member
  9. neurorepro commented on Oct 24, 2022

    @neurorepro

    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 ?

  10. code-asher commented on Oct 24, 2022

    @code-asher
    Member
  11. jneuhauser commented on Oct 25, 2022

    @jneuhauser
    Author

    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?

  12. code-asher commented on Oct 27, 2022

    @code-asher
    Member
  13. jneuhauser commented on Oct 28, 2022

    @jneuhauser
    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?

  14. changed the title [-][Bug]: Markdown preview not working with self signed certificate (SecurityError)[/-] [+]Extensions using web views not working with self signed certificate[/+] on May 22, 2024
  15. added a commit that references this issue on Jul 11, 2024
    6a14070
  16. added a commit that references this issue on Jan 23, 2025
    96931f8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    waiting-for-infoWaiting for more information from submitter

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions