0

I've got an app that interacts with facebook. That mean's I can't test things out on localhost:3000. To fix this, I changed the /private/etc/hosts file so it looks like this:

127.0.0.1       localhost
127.0.0.1       dev.example.com

This worked fine on my old computer, but not on my new one. Now, in order to get things working properly, I have to append the port number when I'm looking at the app in the browser.

dev.example.com:3000

I'm guessing this is an issue with the newer OS (mountain lion), but I'm not sure.

Is there anyway to configure my hosts file so that I don't need to append the port number when I'm in the browser?

jww
  • 83,594
  • 69
  • 338
  • 732
Ben Downey
  • 2,213
  • 4
  • 30
  • 53
  • Also see [Assigning a domain name to localhost for development environment](https://stackoverflow.com/q/7576217/608639) and [Third-Party Signed SSL Certificate for localhost or 127.0.0.1?](https://stackoverflow.com/q/6793174/608639) – jww Mar 04 '18 at 16:47

1 Answers1

1

No; the hosts file only controls how domain names are converted into IP addresses, not the port number part.

The default port for HTTP is port 80. If your Mac doesn't already have something running on port 80, you can tell rails to use that port like this:

rails server -p 80

The change is not likely to be related to upgrading to Mountain Lion; probably something else about your configuration or app changed, if it used to work in the browser without the port number.

dpassage
  • 5,343
  • 3
  • 23
  • 52