Chrome redirects localhost to production

Asked

Viewed 445 times

-1

I don’t know if this is the right place to post this question, if I’m wrong please correct me.

Anyway, I’m trying to access my localhost/passagem and it redirects me to the production site.

I have tried to clear Cache with CTRL+F5, SHIFT+CTRL+F5 and CTRL+R, and also, Google Chrome Hard Reload. I have also tried to reinstall Chrome which also failed to resolve.

I followed in Stack gringo’s footsteps: https://stackoverflow.com/questions/25277457/google-chrome-redirecting-localhost-to-https and it didn’t work either.

I did some tests, I tried to access the localhost by IP 127.0.0.1 and it worked, however, by 127.0.1.1 it redirects to production.

My hosts file (/etc/hosts) has the following IP’s:

127.0.0.1   localhost
127.0.1.1   rodoviario

I tried to change the 127.0.1.1 to 127.0.0.1 and highway to localhost and also could not.

Does anyone have any idea why this happens?

  • Which web server? What programming language? Does your program have any reference to production hostname So the generated links are for example: <a href='https://producao.com'> home </a>?

  • Most likely who’s redirecting you is localhost/passagem, not Chrome.

  • The web server is apache and the language is PHP with HTML and JS

  • It’s funny that Mozilla doesn’t have this problem

1 answer

0

I found the problem

In my project’s header.php there was a condition that if the IP was not 127.0.0.1 it would redirect to production.

It turns out that Chrome accesses the localhost on Ipv6 (::1) so it was redirecting.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.