VS Code and REST API, Hostname does not match certificate's altnames

Hi all,
trying to get this VS Code extension working with my OpenHab2 server. I have got a Letsencrypt certificate installed and working in a nginx reverse proxy, basically following this guide:


I have no problem connecting through app or browser, and the certificate is valid for my internal domain. My server is named openhab.internal.mydomain.com, and this is what my settings.json looks like:
{
    "openhab.host": "https://openhab.internal.mydomain.com",
    "openhab.port": 443,
    "openhab.username": "openhab",
    "openhab.password": "supersecretpassword",
    "openhab.useRestApi": true
}

When I try to connect to OpenHab from Visual Code I get the following error message:

"Error while connecting to openHAB REST API. Hostname/IP does not match certificate's altnames: Host: openhab. is not in the cert's altnames: DNS:openhab.internal.mydomain.com"

It seems like Visual Code tries to communicate using the short name “openhab” instead of the FQDN “openhab.internal.mydomain.com” and of course, this does not match the name specified in the certificate.

Any suggestions what I am doing wrong?

In case openhab is running in your local network, you can just pint to the IP address.
Without the nginx proxy you do not have HTTPS and therefor no certificate that needs to match the hostname.

This is my config:

  "openhab.host": "192.168.1.149",
  "openhab.port": 8080,
  "openhab.username": "",
  "openhab.karafCommand": "ssh openhab@%openhabhost% -p 8101",

But it seems you found a bug and of cause it would be better if it would get fixed in the future. :slight_smile:

Ah, thank you for clarifying this. I will use your suggested workaround for now, and if I get the time I’ll see if I can come up with a proposal which could fix the issue.

I created an issue so this bug does not get lost.