Developing HTTPS Services in Node with Self-Signed Certificates
1–10 of 15 posts
Re: Developing HTTPS Services in Node with Self-Signed Certificates
#2Re: Developing HTTPS Services in Node with Self-Signed Certificates
#3I've never tried to serve HTTPS locally without a proxy (ngrok etc.) or behind a load balancer, because I always end up serving the app with one or the other. And now there's Let's Encrypt. Why would you ever develop with HTTPS locally?
Re: Developing HTTPS Services in Node with Self-Signed Certificates
#4Re: Developing HTTPS Services in Node with Self-Signed Certificates
#5I've never tried to serve HTTPS locally without a proxy (ngrok etc.) or behind a load balancer, because I always end up serving the app with one or the other. And now there's Let's Encrypt. Why would you ever develop with HTTPS locally?
One good reason is to mimic the production environment, as there are an increasing number of browser features that depend on HTTPS (HSTS, cookie secure flags, new html5 APIs like the location api, etc). Though when I do use https locally I also typically use an nginx reverse proxy.
Re: Developing HTTPS Services in Node with Self-Signed Certificates
#6If you own a domain, create a A record for local.mydomain.com and point it to 127.0.0.1 and you can generate a valid cert with Let's Encrypt.
Re: Developing HTTPS Services in Node with Self-Signed Certificates
#7I've never tried to serve HTTPS locally without a proxy (ngrok etc.) or behind a load balancer, because I always end up serving the app with one or the other. And now there's Let's Encrypt. Why would you ever develop with HTTPS locally?
Re: Developing HTTPS Services in Node with Self-Signed Certificates
#8If you own a domain, create a A record for local.mydomain.com and point it to 127.0.0.1 and you can generate a valid cert with Let's Encrypt.
In this case you'll need to use the DNS-01 validation method for the domain issuance, not HTTP-01 (because local.mydomain.com won't be able to receive an inbound validation connection from Let's Encrypt).
Re: Developing HTTPS Services in Node with Self-Signed Certificates
#9$ caddy -host localhost "proxy / localhost:9000" "tls self_signed"
This will serve your Node application (assuming it's on port 9000) at https://localhost:2015/. And you can change the port from the default port with the -port flag.
Re: Developing HTTPS Services in Node with Self-Signed Certificates
#10If you own a domain, create a A record for local.mydomain.com and point it to 127.0.0.1 and you can generate a valid cert with Let's Encrypt.