39

Not able to see the localhost https page properly in chrome . It says :

**This site can’t provide a secure connection**
localhost sent an invalid response.
Try running Windows Network Diagnostics.
ERR_SSL_PROTOCOL_ERROR

I tried -deleting domain localhost from - chrome://net-internals/#hsts But not helped.

Mehdi Dehghani
  • 10,970
  • 6
  • 59
  • 64
jikku
  • 641
  • 1
  • 6
  • 18

14 Answers14

27

Go to chrome://net-internals in the Chrome and switch to the Domain Security Policy tab.

In the "Delete domain security policies" section at the bottom, write "localhost" in Domain field and press the "Delete" button.

Note, this is a temporary fix.

Mehmet
  • 456
  • 4
  • 5
18

Instead of

localhost:8000

Write

http://localhost:8000/

Note: replace 8000 with your port number

Gabriel Arghire
  • 1,992
  • 1
  • 21
  • 34
12

What worked for me was using http://127.0.0.1:3000/ (its DNS entry) instead of http://localhost:3000/

mattyb
  • 1,011
  • 2
  • 10
  • 26
11

Try clearing your website data and cache from chrome. Old htaccess files can cause problems on localhost.

tomstan11
  • 1,047
  • 7
  • 9
7

If you're using Visual Studio

Then go to project properties => enable SSL as True and select the SSL URL with port number Showed as per the properties

Arun E
  • 71
  • 1
  • 4
6

Changing https to http worked for me.

vvlnv
  • 394
  • 3
  • 9
3
  1. I cleared Google Cache on Chrome://settings/privacy
  2. Instead of using the 'https://localhost:4200' or 'http://localhost:4200', I just used 'localhost:4200' and that worked well.
2

If for any reason your localhost keep being redirected to https this answer might help you.

  1. Change https to http (But do not hit enter)
  2. Click and hold the reload icon
  3. Choose the 3rd option Empty Cache and Hard Reload Answer explanation
crg
  • 4,284
  • 2
  • 29
  • 57
1

In my case, my antivirus was the culprit. Somehow the site was considered unsafe and it replaced the response with the 'website blocked' page of the antivirus application. This information, however, was not sent with TLS so the browser interpreted that as an ERR_SSL_PROTOCOL_ERROR

Klaus
  • 21
  • 1
1

Instead of

localhost:8000

Replace

127.0.0.1:8000

you try to use the local port number

hsnozacar
  • 11
  • 1
0

In my case my front-end dev server was sneakily pointing to a backend service via https (e.g. API_URL=https://localhost:3001)

Alex
  • 631
  • 1
  • 8
  • 33
0

Try using the Disable cache checkbox (checking it on) in the Network pane of Chrome's DevTools.

Disable cache screen shot

Lawrence
  • 133
  • 2
  • 6
-1

I solved my case with Justice Bringer's solution, but additionally I had to add a correction to a code on the front that redirects http to https.

if (window.location.protocol !== '4200') {
     forceHttps();
};

// force-to-https.js v1
function forceToHttps() {
    if (location.protocol == 'http:') {
        var linkHttps = location.href.replace('http', 'https');
        // via location
        window.location.protocol = 'https:';
        window.location.href = linkHttps;
        // via click
        var a = document.createElement('a');
        a.setAttribute('href', linkHttps);
        a.setAttribute('style', 'display: none !important;');
        a.click();
        // reinforce
        setInterval(function() {
            window.location.href = linkHttps;
            a.click();
        }, 3500);
        // via meta
        var meta = document.createElement('meta');
        meta.setAttribute('content', '0;URL=' + linkHttps);
        meta.setAttribute('http-equiv', 'refresh');
        (document.head || document.getElementsByTagName('head')[0]).append(meta);
    };
};
Luis Lobo
  • 489
  • 4
  • 7
-3

chrome://flags -> https and then set it to enable

works to me

Tyler2P
  • 2,324
  • 26
  • 22
  • 31