Description
Hi, I have two issues, they may all be related to https certificates.
- One is
code-server
prompt can‘t register serviceworker error - The other is that I can't
load resources dynamically
on my expansion webview.
I run code-server --host 0.0.0.0 --port 8223 --cert
in docker ubuntu:20.04
, and expose 8223
in my Windows 10 host, but I get an ssl error when I open a exntesion webview in code-server in my company.
when I use Chrome command line
"--ignore-certificate-errors", my extension webview can't dynamic loading of resources(eg. js, css), which cause the page style confusion, the Chrome dev tool network display the resource keep pending until it fails.
At first, I thought it was the invalid certificate problem,but even if I use a valid certificate, I still can't dynamic loading resources.(Without any certificate errors and any Chrome command line options)
I use something like this to dynamic loading resources
function addCss(path, callback) {
if(!checkcache(path)) { /*Check if it has been loaded*/
var head = dom.getElementsByTagName('head')[0];
var link = dom.createElement('link');
link.href = path;
link.rel = 'stylesheet';
link.type = 'text/css';
head.appendChild(link); /*Add to HTML*/
link.onload = link.onreadystatechange = function() { /*whether the loading is successful*/
if(!this.readyState || this.readyState === "loaded" || this.readyState === "complete") {
link.onload = link.onreadystatechange = null;
callback();
}
};
cache[path] = 1; /*Store loaded paths*/
}
};
-->
OS/Web Information
- Web Browser: Chrome 90.0.4430.212 64bit
- Local OS: Windows 10
- Remote OS: ubuntu:20.04 (docker)
- Remote Architecture: x86
code-server --version
: 3.9.0
Steps to Reproduce
- installl code-server 3.9.0 in docker ubuntu:20.04
- code-server --host 0.0.0.0 --port 8223 --cert
- enter localhost:8888 and open my extension webview
Expected
No error.
Actual
get an error in bottom right corner:
Error loading webview: Could not register service workers: SecurityError: Failed to register a ServiceWorker for scope ('https://localhost:8223/webview/') with script ('https://localhost:8223/webview/service-worker.js'): An SSL certificate error occurred when fetching the script.