1

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 it 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:

  1. I did edits in notepad on a file on my desktop.
  2. I renamed the original hosts file in the drivers/etc directory.
  3. I copied my file into the drivers/etc directory.
  4. I ran ipconfig -flushdns
  5. I successfully pinged the new site with: ping mysite.dev
  6. I cleared browsing history in all three browsers.
  7. I reopened all three browsers.

All that failed to make any difference (and I rebooted as well) So I added this:

  1. I ran ipconfig -flushdns
  2. Then ipconfig -renew
  3. 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!

2 Answers 2

4

Since early 2018 both Chrome and Firefox browsers (presumably Edge as well) force all domains ending on .dev (and .foo) to be redirected to HTTPS via a preloaded HTTP Strict Transport Security (HSTS) header. More info here.

Google have own the .dev domain (amongst many others). They are now operate a domain registrar service renting domains.

Option 1

Anyhow, for your mysite.dev to work locally, your local machine will need to-:

  • Be able to serve HTTPS
  • Have self-signed certificates in place to handle that.
  • Have that self-signed certificate added to your local trust store (you can't dismiss self-signed certificates with HSTS, they need to be 'trusted' by your computer).

Option 2

Just pick another domain, like mysite.local or mysite.test.

2
  • @sysoectys: that did it! Thanks for the info. I'll tell the instructor. The video he told us to watch is obviously dated.
    – CodeChops
    Commented Aug 25, 2019 at 17:46
  • @CodeChops: glad it helped.
    – suspectus
    Commented Aug 25, 2019 at 17:56
0

This is ALL to run on my local PC. I eventually need it 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)

Well... you need to have a web server running on the computer and listening on 127.0.0.1 in order for a web browser to connect to it. It sounds like you don't have a web server running yet.

1
  • joeqwerty:Thanks for replying. IIS is running on my PC and I can get to localhost or 127.0.0.1 by putting in the URL. Getting mysite.dev running from the host file is an assignment in the class so I have no choice but to figure out why mine doesn't work. In the video lecture he sets it straight up and it works seamlessly. One simple change and boom, done. Took him 2 minutes. I've been working on this since yesterday. Something's not configured right and I'm not able to figure it out.
    – CodeChops
    Commented Aug 25, 2019 at 17:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .