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

HTTPS URL with specific IP is not valid #103

Closed
borekb opened this issue Oct 6, 2018 · 3 comments
Closed

HTTPS URL with specific IP is not valid #103

borekb opened this issue Oct 6, 2018 · 3 comments
Labels

Comments

@borekb
Copy link

borekb commented Oct 6, 2018

When I run ws, I get this message:

$ ws --https
Serving at https://Boreks-MacBook-Pro.local:8000, https://127.0.0.1:8000, https://192.168.1.163:8000

From this, I randomly chosen the last URL given only to encounter the "Your connection is not secure" issue in Chrome. I thought I've got my certificate misconfigured but then I noticed this in the imported lws certificate in macOS Keychain Access:

image

So I tried the 127.0.0.1 address and it worked, as well as localhost. (It still didn't work in Firefox but maybe they handle certificates differently, I don't know, I care mostly about Chrome.)

So maybe with HTTPS, only the first two links should be given? Or could the certificate be updated to work with the specific IP URL as well?

(Additional piece of feedback: for my purposes, I'd be more than happy with a single URL; receiving multiple doesn't make much sense in my scenarios. I guess that's for remote access via network but I never tried that; if that's not very common, maybe it could be hidden behind a flag to make the UX cleaner.)

@75lb
Copy link
Member

75lb commented Oct 6, 2018

So maybe with HTTPS, only the first two links should be given? Or could the certificate be updated to work with the specific IP URL as well?

Yeah, good point. The first option is possible. I'm not sure about the second, I'll look into that too.

Displaying the external IP (e.g. https://192.168.1.163:8000) is useful for people testing web applications from a mobile device on the local network.

@borekb
Copy link
Author

borekb commented Oct 7, 2018

How about something like this?

$ ws --https
Serving at https://localhost:8000
To test on mobile devices from local network, visit https://192.168.1.163:8000

The primary URL could also be green or something.

@75lb 75lb added the question label Apr 16, 2019
@75lb
Copy link
Member

75lb commented Jun 8, 2019

Regarding the last address (https://192.168.1.163:8000) not being covered by the default lws certificate, there's not much I can do about that. The 192.168.x.x IP will be different for every user so I can't create a standardised lws cert which covers every IP permutation (unless you know a way, in which case please share).

You would need to create a cert for your own specific needs:
https://github.com/lwsjs/local-web-server/wiki/How-to-get-the-%22green-padlock%22-with-a-new-self-signed-certificate

You can use --hostname to bind to a single address.

$ ws --https --hostname localhost
Listening on https://localhost:8000

@75lb 75lb closed this as completed Jun 8, 2019
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

2 participants