For development purposes I would like to map 127.0.0.1:3000
(localhost on port 3000) to something like local.example.com
. I want to do this because I am testing an application that incorporates Facebook's SDK (OAuth). It's real pain to have to login to Facebook and change the registered domain for my application each time I make development changes locally. So in my /etc/host
file I have the following:
127.0.0.1 localhost
127.0.0.1:3000 local.example.com
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
local.example.com
<- 404 but localhost:3000 <- works
How can I correctly alias localhost:port to a domain?
No.
The HOSTS file helps map hostnames to IP addresses; this has nothing to do with TCP ports.