I am building a website and would not like to reconfigure the website from pointing to http://127.0.0.1
to http://www.example.com
. Furthermore, the certificate that I am using is of course made with the proper domain name of www.example.com
but my test environment makes calls to 127.0.0.1
which makes the security not work properly.
What I currently want to do is configure my development environment to assign the domain name www.example.com
to 127.0.0.1
so that all http://www.example.com/xyz
is routed to http://127.0.0.1:8000/xyz
and https://www.example.com/xyz
is routed to https://127.0.0.1:8080/xyz
.
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.
To develop locally using a domain name instead of 'localhost:3000' in the URL with create-react-app, we can edit the hosts file to map localhost to a URL. to map the localhost 127.0. 0.1 IP address to somedomain.com . Then we can open our app in the browser with somedomain.com:3000 .
Click Start and type "IIS". Then click "Internet Information Services (IIS) Manager" to open the Internet Information Services (IIS) Manager. Right-click on the "Sites" and select the "Add Website..." option from the list. Now, enter the details as per the given fields and your requirements.
Replace localhost with the value from server on domain image. Replace root with username value from domain image. Where you see empty single quotes near password in the code, use the password from the domain image. Replace calendarevent with cl41-...
If you edit your etc/hosts file you can assign an arbitrary host name to be set to 127.0.0.1. Open up /etc/hosts in your favorite text editor and add this line:
127.0.0.1 www.example.com
Unsure of how to avoid specifying the port in the HTTP requests you make to example.com, 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With