Assigning a domain name to localhost for development environment


I am building a website and would not like to reconfigure the website from pointing to to Furthermore, the certificate that I am using is of course made with the proper domain name of but my test environment makes calls to which makes the security not work properly.

What I currently want to do is configure my development environment to assign the domain name to so that all is routed to and is routed to

I am not using Apache. I am currently using node.js as my web server and my development environment is in Mac OS X Lion.

3/4/2018 4:37:23 PM

Accepted Answer

If you edit your etc/hosts file you can assign an arbitrary host name to be set to Open up /etc/hosts in your favorite text editor and add this line:

Unsure of how to avoid specifying the port in the HTTP requests you make to, but if you must avoid specifying that at the request level, you could run nodejs as root to make it listen on port 80.

Edit: After editing /etc/hosts, you may already have the DNS request for that domain cached. You can clear the cached entry by running this on the command line.

dscacheutil -flushcache
9/27/2011 10:21:38 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow