Hacker News new | ask | show | jobs
by tialaramex 2894 days ago
This isn't true for localhost. But some browsers don't know whether "localhost" is really localhost, so for best compatibility write 127.0.0.1 or ::1 as appropriate

If you need to simulate HTTPS for your local host, but you actually control all the moving parts (e.g. a dev environment) you can use any private key + associated certificate for a DNS FQDN you control, then use /etc/hosts or its moral equivalent to tell your local machine that this name is on the local loop, and the key + certificate will validate.

You must not ship this as a "product" because when you do that all the end users end up with the private key, which both destroys the whole _point_ of public key cryptography AND violates the terms of whichever CA issued you with the certificate.