David Yates
David Yates

Reputation: 2220

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.

Upvotes: 10

Views: 9521

Answers (1)

Travis L. Riffle
Travis L. Riffle

Reputation: 144

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

Upvotes: 13

Related Questions