Adding 127.0.0.1 to hosts file to redirect locally has error. Says my site “refused to connect.” - google-chrome

I answered this below for anyone that is interested
I'm on Windows 10 using Chrome, Firefox and MS Edge. I'm trying to do something for a class I'm taking and can't get it to work. All I want to do is add something like this to the hosts file:
127.0.0.1 mysite.dev
This is ALL to run on my local PC. I eventually need to have my site able to run on IIS, but this is the first step and I can't get past it. (I'm on my second day trying)
What I've done:
I did edits in notepad on a file on my desktop.
I renamed the original hosts file in the drivers/etc directory.
I copied my file into the drivers/etc directory.
I ran ipconfig -flushdns
I successfully pinged the new site with: ping mysite.dev
I cleared browsing history in all three browsers.
I reopened all three browsers.
All that failed to make any difference (and I rebooted as well) So I added this:
I ran ipconfig -flushdns
Then ipconfig -renew
Then ipconfig -registerdns
Then repeated steps 5->6 and all failed to make any difference. These are the errors per browser:
Chrome: This site can’t be reached mysite.dev refused to connect.
Firefox: Unable to connect Firefox can’t establish a connection to the server at www.mysite.dev.
MS Edge: Hmmm...can’t reach this page
I noticed that all three browsers changed http to https. Not sure if that mattered but I followed instructions to disable this re-direct for all three browsers and NONE of them actually stopped the redirect to https.
And I still can't the correct result, which should be the IIS default page. I can see the IIS default page with localhost, so IIS is running.
Help! Any ideas or directions at all would be very appreciated!

Got the answer from someone. Google owns the .dev domains and has restrictions on it so it HAS to be HTTPS, which requires certs etc, which is not in the scope of my class. I just changed it to mysite.local and BOOM!, there it was! Thanks.

Related

Chrome not respecting hosts file entry

I have used a method for years that has worked for me and limited any mysterious domain-based issues with cookies and such.
In my /etc/hosts file, I do the following for the local development version of www.mysite.com:
127.0.0.1 localhost local.mysite.com
When I visit http://local.mysite.com:3000, this has done exactly what you'd expect for years and years, and still works in Safari and Firefox. However, Chrome started stubbornly giving me an ERR_CONNECTION_REFUSED message a few months ago, and I can't make it work. If I visit http://localhost:3000, it works fine, but I avoid developing against localhost for various reaions. I have tried every possible thing I can find on the internet (clearing caches etc), and nothing has made the error go away.
Anyone have any idea what can be done here?
In the browser, please clear host cache and then try it out. To clear host cache, follow the steps below
Open up Chrome browser and enter " chrome://net-internals/#dns " in the address bar without quotes
Click on the button Clear host cache
Restart your browser and try again
You need to disable the dns prefetching and network condition predicting services on chrome.
As chrome is trying to look for local.mysite.com in actual dns servers and not finding the local ip address.
You can see the below steps -
Go to chrome://settings
Click on "Show advanced settings..."
Unmark the Predict network actions to improve page load performance
box.
Check if the DNS prefetching is really disabled by going to
chrome://dns.
You should see there something like DNS pre-resolution and TCP
pre-connection is disabled.

Empty Response only on HTTPS, only with Google Chrome

For the last few months we've has a client site working fine over HTTPS and HTTP, however as of a week or two ago we've had intermittent reports of it failing in Google Chrome.
As of last week I also got the issue, which is Chrome claiming ERR_EMPTY_RESPONSE to all requests sent through HTTPS.
This isn't replicated in any other browsers and the Security tab of the inspector declares the certificate valid and all page resources secure.
Anyone got some suggestions? I'm at a loss as to what to do, it feels like it might be a browser bug itself...
[Originally provided by a user called #daFlame, but it then got deleted within a few hours?]
The issue is caused by Chrome struggling with the cipher suites cPanel uses by default. CPanel are aware of the issue, and I've reported a ticket to Chrome.
CPanel's work around can be found here, but I'll provide a summary:
Go to WHM >> Service Configuration >> Apache Configuration >> Global Configuration
Then find the value SSL Cipher Suite and change it from the default to:
ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS`
Once Apache is rebuilt, the errors stop.

Chrome insists on accessing localhost through HTTPS, any way to change that?

I have a local webdev setup using AMPPS on OSX. I've done most of my work on Firefox and that's been working fine, but trying it on Chrome today gave me a whole bunch of Failed to load resource: net::ERR_CONNECTION_CLOSED errors everywhere. Looking further it seems like Chrome wants to access every resource through HTTPS. Firefox doesn't have this issue, it access all resources through HTTP and the site displays fine.
Is there any way to force Chrome to access localhost through regular HTTP? I've tried every solution I could find - including going to chrome://net-internals/#hsts and deleting localhost (localhost doesn't show up in the domain query so there's nothing to delete) - and nothing seems to work.

Chrome localhost does not work

I have defined some virtual servers that until the last days were working fine.
Now they don't on Chrome, but there are no problems in firefox or safary.
I get this:
This webpage is not available
ERR_ICANN_NAME_COLLISION
Hide details
This site is using a new generic top-level domain (gTLD). If you have
used loc.dev to access an internal site in the past, contact your
network administrator.
I found as a solution:
Set the "Built-in Asynchronous DNS" to "Disabled" in chrome://flags, but the is no such flag in my chrome version ( 43.0.2357.81 )
Do you know a solution for this?
LE : If i move the site on the htdocs file and i go on the url http://localhost, it works. It seems that it has a problem only with virtualhosts.
Got the same issue after updating to the latest chrome version last night. I was getting a ERR_NAME_NOT_RESOLVED error only on google chrome for all of my virtual hosts. Here's how that looked.
Screen Shot-> DNS name not resolved error
Here's the fix I made.
Clear up the google DNS cache by typing this in the Chrome browser
chrome://net-internals/#dns
Screenshot -> Flushing Chrome DNS cache
You will see a button "Clear Host Cache". Press that DNS cache
will be flushed.
Keep this DNS window open. Now access the virtual host in the browser
for me it was http:/api.localhost. Once you do that you will see a
new entry in the DNS window. for me it was "localhost."
notice the period "." at the end of localhost that showed an error.
Last step is to simply add this entry as to your localhost file.
Your hosts file should be updated with an entry to resolve localhost. to 127.0.0.1:
# dont forget the trailing . !!!
127.0.0.1 localhost.
in the hosts file located at:
for linux : /etc/hosts
for windows : C:\Windows\System32\drivers\etc\hosts
Another solution for your case might be to ditch the .dev at the end of your local virtual host domain
This has to do with some new changes by google. ".dev" comes under google's TLD (In the corner of the internet where people care about DNS, there is a bit of an uproar at Google's application for over a hundred new top-level domains, including .dev)
Try this Use a domain name you own. Possibly using the full name like "localhost.dev.$yourdomain" could help you here depending on your setup.
With the 'chrome' I face the same issue because by mistake I comment out the
127.0.0.1 localhost from the host file, But 'Firefox' will work.
Just make sure your host file include
127.0.0.1 localhost
FIXING
Try contacting your system administrator.
ERR_ICANN_NAME_COLLISION.
if you are using magento and getting such error
just go to you database and search for core_config_data
click on it then check your web store name
change the store name
restart your wamp and fixed.
Worked for me:
chrome://net-internals/#hsts -> Domain Security Policy -> Delete domain security policies -> enter there localhost and press delete
Here is another catch for you, my virtual hosts in Windows hosts file were defined as:
127.0.0.1 bla.bla.bla.localhost
127.0.0.1 bla2.bla2.localhost
And actual server virtual host directives in Xamp Apache Vhosts file made it all work nicely in all browsers, but Chrome!
A simple fix - dont end with full "locahost" word, rename the vhosts to end with anything else, just "loc" did it in my case, all works in Chrome now!
Been having this problem with Version 56.0.2924.87 (64-bit) of chrome, attempting to access a vm by gset.localhost, just would not work.
Changed the url in the hosts file to gset.loc and it works fine.
The answer seems to be do not use localhost in your hosts file urls when attempting to access a virtual machine running on your machine using chrome.
All browsers - chrome, firefox, safari were not resolving my virtual host and kept re-directing to www.mysite.dev
After pulling my hair for hours - it turned out I just need to change mysite.dev to www.mysite.dev in the /etc/hosts file.

Chrome & Firefox keep asking for authentication when going to localhost

I'm having a problem where Chrome & Firefox have both started bringing up a popup window saying authentication required when going to localhost (401 page).
If I am on the network I can put in my usual network username/password and it works fine, but if I'm offline (the very reason I'm using localhost) that authentication fails and I get sent to a 403 page.
This does not happen in IE and was not happening a few days ago, my network settings are set to ignore Proxy on localhost and auto detect settings is switched off.
Any ideas?
Problem is the permission of your site directory. If you put the folder under your home (~), then this problem will probably occurs. Try to give your home folder a wider permission. Especially read permission for Others.
sure, if you browse the localhost pure directory you need apache / server authentication
Check your server authentication credentials (user and pass) and this is normal!
while if you browse localhost/mysite you will need not an auth ;)
also be sure your localhost/myproject folder has 755 chmod permissions
finally check if in your localhost/myapp/ there is a .htpasswd file and post it here
I also encountered a similar problem and reinstalling chrome to older version, changing proxy setting didn't help.
I have started using other browsers, however i use the below workaround in case I need to work in chrome.
1.) Click on login without inserting any username and password .
2.) Click on (X) to close the window.
The window would disappear. However, it will reappear if you open any other site or window.