Posts

Showing posts with the label /etc/hosts

How to add additional dns host mapping to localhost

Why we need additional dns host mapping? In enterprise environments, some applications can serve into multiple domains. For example, same running instance(s) can be mapped for guest.example.com and customer.example.com and the functionality of the application could vary based on the domain being used by the user. Lets say, customer.example.com will need authentication, authorization and may contain premium features for customers, whereas guest.example.com will contain limited features. To test this type of application in local, which contains domain aware functionalities, we need to map additional routes in the OS host file to map these domains to localhost. And then the tests can make use of these domains to test the application running in local development machine. For Mac: Add the following lines to /private/etc/hosts file using vi or nano or any text editor application. Might need to use sudo if required. 127.0.0.1       local.example.com ...