Menu

1 / 2

Self-Signed Certificates for localhost Development

DEV Community·Dima Stopel·6 months ago
#Z8NPHrzK
#ssl#tls#security#localhost#server
Reading 0:00
15s threshold

Originally published on cert-depot.com . Free, open-source self-signed certificate generator — no signup, keys never stored.

Self-Signed Certificates for localhost Development

Stop clicking past browser warnings. Get a proper green-padlock HTTPS localhost in a few minutes.

Most modern web APIs require HTTPS: Service Workers, Web Crypto, geolocation, camera access, OAuth flows, HTTP/2. Developing locally against HTTP hits constant "feature unavailable" errors. A self-signed cert for localhost fixes this — but only if you trust it properly.

Step 1: Generate the certificate

With cert-depot.com : enter localhost as the Common Name, add 127.0.0.1 and ::1 as IP SANs, generate.

With OpenSSL:

openssl req -x509 -newkey rsa:2048 -nodes \ -keyout localhost.key -out localhost.crt \ -days 365 \ -subj "/CN=localhost" \ -addext "subjectAltName=DNS:localhost,IP:127.0.0.1,IP:::1"

Enter fullscreen mode

Exit fullscreen mode

Step 2: Trust it in your OS

This is the step that makes the browser warning go away.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.