Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you stop Chome from always redirecting to https (not desired)?

Somehow my environment has been changed such that every Angular project I enter and run ng serve command on now redirects to the https port. Even if I use --ssl false option, it still redirects to https.

I suspect that this is some change to the node environment. I've looked through environmental variables and combed the net trying to find ways of turning SSL OFF, but all I find are articles that speak of turning it ON. Most of them are VERY intentional changes to the Angular.json file or they are use a command that specifies the certificate and key.

If you could point me to the right documentation or put me on the right path, I would greatly appreciate it.

like image 997
David Yates Avatar asked Aug 08 '19 16:08

David Yates


People also ask

Why do I keep getting redirects on chrome?

A Google Chrome redirect loop error occurs when the owner of a website changes their website URL (address) and the old one redirects you to the new one. Because this could be used maliciously, Google gives you an error when you try to reach the site.

Do browsers automatically redirect https?

In its default configuration, without explicit action by the user or the web site, no major browsers would automatically use HTTPS. If you redirect HTTP to HTTPS, make sure to mark your cookies as secure so you don't leak them in the initial accesses through http.


Video Answer


1 Answers

In the case of our company - it appears that it's related to a domain policy probably put in place by our IT Department.

One clue is the Network Traffic in chrome debugger: 307 Internal Redirect and the response header has: Non-Authoritative-Reason: HSTS

Try going to: chrome://net-internals/#hsts and if you have authority, deleting the policy for "localhost."

If you can't delete this, then I advice following the steps from this article which also worked for me: https://medium.com/@richardr39/using-angular-cli-to-serve-over-https-locally-70dab07417c8

like image 143
Travis L. Riffle Avatar answered Oct 19 '22 02:10

Travis L. Riffle