How can I get my local or dockerized Theia to use https?

My extension’s webviews don’t work when I run theia locally, but they do work when I run it in Theia in Che. I suspect the difference is because in che we’re using https. How do I get local theia to use https?

[original thread by Tim Etchells]

[Tim Etchells]

I tried export THEIA_WEBVIEW_EXTERNAL_ENDPOINT=localhost and then the error changed to “can’t establish a connection to localhost”.
Then I tried export THEIA_WEBVIEW_EXTERNAL_ENDPOINT=localhost:3000 and then the error changed to a 404 "Cannot GET /webview/index.html

Please look through https://spectrum.chat/theia/dev/using-vscode-extension-ms-sarifvscode-sarif-viewer-in-local-docker-fails~41a2d782-8405-4d19-942e-e66076c34f49.https://spectrum.chat/theia/dev/using-vscodeextensionmssarifvscodesarifviewer-in-local-docker-fails~41a2d782-8405-4d19-942e-e66076c34f49 Similar issue was resolved there.

@timetchells you may also take a look at the https docker example theia-https

[Tim Etchells]

After some more testing, the problem is not related to http/s. It is because you are not supposed to subdomain localhost. It works in Chrome because of https://webmasters.stackexchange.com/questions/88636/why-does-chrome-resolve-websitename-localhost-as-localhost
but it does not work in other browsers

[Tim Etchells]

If you want to reproduce it, you can download my extension here:
http://download.eclipse.org/codewind/codewind-vscode/master/latest/codewind.vsix
and install it into Theia. It will try to open the home page webview when it activates, and fail.

yes, there are issues filed for FireFox to allow subdomain localhost, it generally makes testing of latest Web features nightmare locally