Fix 'NET::ERR_CERT_AUTHORITY_INVALID' and Self-Signed Certificate Errors
Resolve SSL/TLS certificate trust errors in development, curl, Node.js, and local HTTPS environments.
NET::ERR_CERT_AUTHORITY_INVALID / self signed certificate in certificate chain
# Step 1: Install trusted local CA using mkcert brew install mkcert # or choco install mkcert mkcert -install # Step 2: Generate trusted certs for localhost: mkcert localhost 127.0.0.1 ::1 # In Node.js development only (.env.development): # NODE_TLS_REJECT_UNAUTHORIZED=0 (DO NOT USE IN PRODUCTION)
Root Cause & Mechanism Analysis
Why does this error occur?
The browser or Node.js does not recognize the certificate authority that signed the SSL certificate (common with mkcert, self-signed dev certificates, or missing intermediate CA certificates).
Frequently Asked Questions
Why is NODE_TLS_REJECT_UNAUTHORIZED=0 dangerous?
Related Developer Error Solutions
Browse All 35 GuidesFetch: TypeError: Failed to fetch
Diagnose network drops, CORS blocks, HTTPS certificate invalidity, and ad-blocker request cancellations.
CORS 'Access-Control-Allow-Origin' Missing
Resolve browser cross-origin resource sharing errors by configuring backend HTTP headers and handling preflight OPTIONS requests.
Nginx 502 Bad Gateway
Resolve reverse proxy gateway errors when Nginx cannot establish a connection with Node.js, Next.js, or Gunicorn backends.