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

LSP and REST via https not working together #83

Open
lsiepel opened this issue Jan 13, 2018 · 6 comments
Open

LSP and REST via https not working together #83

lsiepel opened this issue Jan 13, 2018 · 6 comments
Labels

Comments

@lsiepel
Copy link

lsiepel commented Jan 13, 2018

When using https, i can't use LSP. Even when LSP port 5007 is reachable (local network)

With this workspace config i got REST to work, but LSP isn’t
{
"openhab.host": "https://my.domain.tld",
"openhab.port": 443,
}

When the config is changed to a fixed IP, the LSP is working but REST isn't. (nginx is set only to allow https on port 443)
{
"openhab.host": "192.168.1.255",
"openhab.port": 443,
}

Not sure how the host string is handled within the VS Code extension, but i guess https:// is not stripped when used for LSP server connection. Edit: Just checked https://github.com/openhab/openhab-vscode/blob/master/src/LanguageClient/LanguageClientProvider.ts and it's not stripped.

I would recommend an extra setting: openhab.usehttps {false|true} that defaults to false. And disallow any other string in openhab.host then DNS or IP.
{
"openhab.host": "my.domain.tld",
"openhab.usehttps": true,
"openhab.port": 443,
}

That way it's more clear how https can be configured and you can use this new setting to support both LSP and REST at the same time when using https.

@kubawolanin
Copy link
Collaborator

Hey @lsiepel,
Didn't test my setup with HTTPS so can't tell from experience, but the function that extracts host from configuration parameters is here -> https://github.com/openhab/openhab-vscode/blob/master/src/Utils.ts#L27

IMO there's no need to introduce a new configuration parameter if we can pass https to the URI string (https://abcd.tld or https://192.168.0.1). Maybe I'm missing something here.
Anyways, feel free to submit a PR.

Also see #82 and this post - it contains not yet released version of the extension with a fix for REST connection.

@lsiepel
Copy link
Author

lsiepel commented Jan 14, 2018

Well, it might not be needed because it works, but imho the boolean is cleaner and clear from a user perspective. Anyway thanks for your comment, i installed the 0.3.5 from the file, but no luck.

Could it be that because the setting openhab.host is used for both UI-stuff (REST, classic ui etc.) and LSP, while containing the protocol, both have to be on the same protocol?

Many people make use of https because they have the openHAB accessible from the internet. But LSP is almost never publicly available and about nobody serves it by https.
If this is the cause, i would suggest to be able to override the protocol for LSP in some VS Code setting.

I'm a C# and VS2015 amateur, before i make PR's i have a to learn a lot. :-)

@pinkkoff
Copy link

pinkkoff commented Jan 8, 2019

last comment was one year ago...
Is there any way now to use https with domain name with auth, deny access to OH via LAN (only with proxy) and use LSP?

@lsiepel
Copy link
Author

lsiepel commented Jan 8, 2019

Well, i never managed to get it to work. IMHO, LSP and REST are two seperate consumable sources and they should be configurable individually. Unfortunately, im unable to construct a PR because of a lack of skills and time.

@Confectrician
Copy link
Collaborator

See my comment in another issue:
#82 (comment)

Probably this will be easier in the future.
At least our local lsp should provide a good entry point with https enabled rest api.
THere is a remote variant too, which may not work with a https only setting but there should at least be "some" functionality always.

@Mr-iX
Copy link

Mr-iX commented May 21, 2019

I have exactly the same issue in the current version.

I shared more information in this openHAB community thread:
https://community.openhab.org/t/vscode-extension-0-5-1-update-available/74739/20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants