Live data from Hacker News

Lcl.host: fast, easy HTTPS in your local dev environment

anchor.dev

61–70 of 101 posts

Re: Lcl.host: fast, easy HTTPS in your local dev environment

#61
Some things I learned about trusted localhost HTTPS:

* Windows is the easiest... by far. There is only one trust store and its extremely easy to access at different levels of trust. Firefox has its own trust store so you can either add your certs to both the Windows store AND the Firefox trust store or flip a config in Firefox to tell it to use the Windows trust store like everyone else.

* Linux is a challenge because you have to add your certificates to the OS trust store and then each browser has their own trust stores.

* MacOS is pretty close to impossible, at least fully automated. If the cert is not registered with a third party of the OS's choosing the cert will not be trusted in the browser. The way around this is to manually add your localhost cert chain to the MacOS keychain.

If anybody wants an example here is something I wrote a ways back in JS (but please be warned its specific to my application:

* Build the certificate chain - https://github.com/prettydiff/share-file-systems/blob/master...

* Install the cert by OS type - https://github.com/prettydiff/share-file-systems/blob/master...

That second sample also installs pcap so that I can serve on localhost over ports 80/443.

Re: Lcl.host: fast, easy HTTPS in your local dev environment

#62
post #40

Earlier quoted context omitted.

> There are a number of APIs, such as geolocation, that only work over https And localhost https://developer.mozilla.org/en-US/docs/Web/Security/Secure...

Might have changed, but last time I tried to use the Clipboard API it didn't work on localhost without https

I would be very surprised if that were the case. Localhost gets special privileges in most browsers

Re: Lcl.host: fast, easy HTTPS in your local dev environment

#63

It surprises me how few people dev/test against HTTPS, given that it isn't exactly hard to setup manually (with tools like this making it even easier). Just point a wildcard DNS entry at 127.0.0.1 or some other useful address if your dev copy is actually not that local, and chuck a web server there acting as a proxy to what-ever apps, with a LetsEncrypt wildcard cert. It isn't zero work, but saves time in the long ru…

I never work locally. Always remote. Dev.xxx.com, stg.xxx.com etc

Re: Lcl.host: fast, easy HTTPS in your local dev environment

#64
post #58

Earlier quoted context omitted.

we're going to say more about how lcl.host works between containers in the future since it ends up pulling in Anchor's package features, but I can give a quick rundown of what we've done in the past with docker-compose: start a service in container A and expose port 44300, and configure the service with an ACME client to provision a `service-a.lcl.host` certificate. The clients in that container won't trust the cert,…

“Clients in that container won’t trust the cert”. Yeah, there’s the trick. “service-a.lcl.host:443300“ so when inside the container, won’t that resolve to 127.0.0.1 which is the container internal loopback interface not the docker host’s interface? Hence trying to connect to itself not its sibling.

right it's the loopback, but I believe docker-compose can forward loopback ports to the host (and then back into the other container) using links, but i'm fuzzy on the details and may be misremembering.

Re: Lcl.host: fast, easy HTTPS in your local dev environment

#65
I just use cloudflare tunnels (cloudflared) - don't have to install any certificates, it's all handled by cloudflare. Yes, it exposes globally, but that's often convenient to share a link to my dev with colleagues. And it has been fast enough. Downside is that you need internet connectivity.

Re: Lcl.host: fast, easy HTTPS in your local dev environment

#66

I like the interactive setup. I think this is solid but if you want something even faster and easier to use, try my project localias [0]. The parent project, lcl.host, has some annoying restrictions: > This CA has some restrictions though: it can only issue certificates for subdomains of lcl.host and localhost, but that’s all you need for local development. Localias, on the other hand, lets you use any custom domain…

Oh man, I was up and running in my project in less than one minute. Thanks!

I'm glad it worked for you and was easy to set up. If you run into any trouble or have any feature requests, please file an issue on github!

Re: Lcl.host: fast, easy HTTPS in your local dev environment

#67

Warning: This checks if it’s running the latest version and refuses to run if it isn’t up to date. They just released v0.0.16 15 minutes ago and the update hasn’t hit Homebrew yet, so it has completely disabled itself and won’t run. There doesn’t seem to be any option to skip the version check. So don’t use this unless you don’t mind it breaking randomly whenever there’s an update.

That's an absurd tactic I've not seen since last time I used Firefox.

you're completely free to run firefox from 5 years ago and it will not refuse to run.

Re: Lcl.host: fast, easy HTTPS in your local dev environment

#68

I like the interactive setup. I think this is solid but if you want something even faster and easier to use, try my project localias [0]. The parent project, lcl.host, has some annoying restrictions: > This CA has some restrictions though: it can only issue certificates for subdomains of lcl.host and localhost, but that’s all you need for local development. Localias, on the other hand, lets you use any custom domain…

This looks fantastic! Does it support node extra ca cert etc? I’ve had that issue with mkcert in the past and it’s easy to fix but another thing to keep track of in these already complex dev setups if you’re doing local https.

Re: Lcl.host: fast, easy HTTPS in your local dev environment

#69
post #68

I like the interactive setup. I think this is solid but if you want something even faster and easier to use, try my project localias [0]. The parent project, lcl.host, has some annoying restrictions: > This CA has some restrictions though: it can only issue certificates for subdomains of lcl.host and localhost, but that’s all you need for local development. Localias, on the other hand, lets you use any custom domain…

This looks fantastic! Does it support node extra ca cert etc? I’ve had that issue with mkcert in the past and it’s easy to fix but another thing to keep track of in these already complex dev setups if you’re doing local https.

I don't understand what you mean, what is "node extra ca cert etc" and what is the issue with mkcert?

Localias wraps Caddy to handle all the cert provision; I believe Caddy uses mkcert. I haven't seen any bug reports about yet, but if you give it a try and run into an issue I would be happy to help fix it.

Re: Lcl.host: fast, easy HTTPS in your local dev environment

#70

I like the interactive setup. I think this is solid but if you want something even faster and easier to use, try my project localias [0]. The parent project, lcl.host, has some annoying restrictions: > This CA has some restrictions though: it can only issue certificates for subdomains of lcl.host and localhost, but that’s all you need for local development. Localias, on the other hand, lets you use any custom domain…

This would be perfect if combined with Traefik's method of config via docker tags.
Post reply on HN