This is a followup question to Google Chrome redirecting localhost to https.
Does anyone know, how to permanently exclude localhost
from HSTS list in Google Chrome?
Or, any other elegant solution that wouldn't require developer to visit chrome://net-internals/#hsts
and delete localhost
every time when switching from working on an HTTPS project to a different project on HTTP?
Update:
You can install a proper SSL certificate for those domains if you want to for free, so you won't need to mess around with HSTS. Take a look here.
You may edit your system's hosts file:
C:\Windows\System32\drivers\etc\hosts
/etc/hosts
In there you can define a different domain for each project:
127.0.0.1 project1.local
127.0.0.1 project2.local
127.0.0.1 projectN.local
Note: I'm using *.local domains (you can use virtually anything) because you have already set localhost to redirect to https, and such we have to use a different domain. Although I strongly recommend you to install a real SSL certificate and reset to default any modifications you have made on HSTS.
Once saved, when you navigate to those domain in any browser it will load from 127.0.0.1
(localhost). If you use apache/nginx as server you optionally can define VirtualHosts for each domain also so you don't need to change your httpd folder every time you switch projects.
Then of course you will have to re-issue any certificate that you may have for those projects for the new domains, but those would be unique for each project. And on Chrome you would not need to be messing net-internals more than once for each domain for the projects which you don't have a certificate (and 0 times for those with certificate).