Tuesday, April 5, 2016

HSTS. Local site redirects to Google


 believe this is caused by HSTS - see http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security
If you have (developed) any other localhost sites which send a HSTS header...
eg. Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
...then depending on the value of max-age, future requests to localhost will be required to be served over HTTPS.
To get around this, I did the following.
  • In the Chrome address bar type "chrome://net-internals/#hsts"
  • At the very bottom of a page is QUERY domain textbox - verify that localhost is known to the browser
  • If it is, DELETE the localhost domain using the textbox above
  • Your site should now work using plain old HTTP
This is not a permanent solution, but will at least get it working between projects. If anyone knows how to permanently exclude localhost from the HSTS list please let me know :)

 experienced the same problem in Chrome and I tried unsuccessfully to use BigJump's solution.
I fixed my problem by forcing a hard refresh, as shown in this blog (originally from this SuperUser answer).
  1. Open the Developer Tools panel (CTRL+SHIFT+I)
  2. Click and hold the reload icon.
  3. A menu will open.
  4. Choose the 3rd option from this menu ("Empty Cache and Hard Reload")

No comments:

Post a Comment