Chrome:The website uses HSTS. Network errors...this page will probably work later
Solution 1:
One very quick way around this is, when you're viewing the "Your connection is not private" screen:
type badidea
type thisisunsafe
(credit to The Java Guy for finding the new passphrase)
That will allow the security exception when Chrome is otherwise not allowing the exception to be set via clickthrough, e.g. for this HSTS case.
This is only recommended for local connections and local-network virtual machines, obviously, but it has the advantage of working for VMs being used for development (e.g. on port-forwarded local connections) and not just direct localhost connections.
Note: the Chrome developers have changed this passphrase in the past, and may do so again. If badidea
ceases to work, please leave a note here if you learn the new passphrase. I'll try to do the same.
Edit: as of 30 Jan 2018 this passphrase appears to no longer work.
If I can hunt down a new one I'll post it here. In the meantime I'm going to take the time to set up a self-signed certificate using the method outlined in this stackoverflow post:
How to create a self-signed certificate with openssl?
Edit: as of 1 Mar 2018 and Chrome Version 64.0.3282.186 this passphrase works again for HSTS-related blocks on .dev sites.
Edit: as of 9 Mar 2018 and Chrome Version 65.0.3325.146 the badidea
passphrase no longer works.
Edit 2: the trouble with self-signed certificates seems to be that, with security standards tightening across the board these days, they cause their own errors to be thrown (nginx, for example, refuses to load an SSL/TLS cert that includes a self-signed cert in the chain of authority, by default).
The solution I'm going with now is to swap out the top-level domain on all my .app and .dev development sites with .test or .localhost. Chrome and Safari will no longer accept insecure connections to standard top-level domains (including .app).
The current list of standard top-level domains can be found in this Wikipedia article, including special-use domains:
Wikipedia: List of Internet Top Level Domains: Special Use Domains
These top-level domains seem to be exempt from the new https-only restrictions:
- .local
- .localhost
- .test
- (any custom/non-standard top-level domain)
See the answer and link from codinghands to the original question for more information:
answer from codinghands
Solution 2:
When you visited https://localhost previously at some point it not only visited this over a secure channel (https rather than http), it also told your browser, using a special HTTP header: Strict-Transport-Security (often abbreviated to HSTS), that it should ONLY use https for all future visits.
This is a security feature web servers can use to prevent people being downgraded to http (either intentionally or by some evil party).
However if you then then turn off your https server, and just want to browse http you can't (by design - that's the point of this security feature).
HSTS also does prevents you from accepting and skipping past certificate errors.
To reset this, so HSTS is no longer set for localhost, type the following in your Chrome address bar:
chrome://net-internals/#hsts
Where you will be able to delete this setting for "localhost".
You might also want to find out what was setting this to avoid this problem in future!
Note that for other sites (e.g. www.google.com) these are "preloaded" into the Chrome code and so cannot be removed. When you query them at chrome://net-internals/#hsts you will see them listed as static
HSTS entries.
And finally note that Google has started preloading HSTS for the entire .dev domain: https://ma.ttias.be/chrome-force-dev-domains-https-via-preloaded-hsts/
Solution 3:
Click anywhere in chrome window and type thisisunsafe
(instead of badidea
previously) in chrome.
This passphrase may change in future. This is the source
https://chromium.googlesource.com/chromium/src/+/master/components/security_interstitials/core/browser/resources/interstitial_large.js#19
According to that line, type window.atob('dGhpc2lzdW5zYWZl')
to your browser console and it will give you the actual passphrase.
This time the passphrase is thisisunsafe
.