Home / Localhost / localhost https SSL error

localhost invalid response / ERR_SSL_PROTOCOL_ERROR: fix

Fix ERR_SSL_PROTOCOL_ERROR and invalid response errors on localhost: use http, clear the saved HTTPS rule, or set up a trusted local certificate.

These errors usually mean the browser used https:// but your local server only speaks plain http, so the secure handshake fails. Often Chrome added https on its own, because of a saved rule for localhost.

What to do, step by step

  1. Type the full address with http://, for example http://localhost:3000.
  2. If Chrome keeps switching to https, open chrome://net-internals/#hsts, type localhost under "Delete domain security policies" and click Delete.
  3. Clear the saved redirect: in Chrome open Settings, Privacy, then delete the cached files for the last hour.
  4. If you really need https locally, create a trusted certificate with mkcert (steps below) and configure your server to use it.
  5. Restart the dev server and open the address again.

Commands you can copy

Install mkcert's local authority (once per computer)
mkcert -install
Create a certificate for localhost
mkcert localhost 127.0.0.1 ::1

Other causes to check

NET::ERR_CERT_AUTHORITY_INVALID on https://localhost
The certificate is self-signed and not trusted. Use mkcert to make one your computer trusts, or accept the warning once for testing only.
Firefox shows SSL_ERROR_RX_RECORD_TOO_LONG
Same cause: https:// was used on a plain http port. Switch to http://.
A redirect rule sends you to https
Remove the HTTPS redirect from your local server or .htaccess while you develop.
Port 443 vs your dev port
https://localhost uses port 443 by default. If your server runs on 3000, write the port and the scheme that matches it.

Questions about localhost https SSL error

Do I need https on localhost?
Usually not. Browsers treat localhost as a secure context, so most features work on plain http. You need https only to test things like secure cookies behind a real domain name.
What is mkcert?
A small tool that creates a certificate authority on your own computer and certificates that your browser trusts. It is meant for development only.
Is it safe to click "proceed anyway"?
On your own localhost it is fine. Never do it on a real website with a certificate warning.

Updated 2026-10-11

Config generators for this

Related pages