Reputation: 443
I am working on expressjs application. locally my application run on http://localhost:3000, I want to run this application on http://localhost.mycomp.com as well.
is it possible to achieve this without editing /etc/hosts/ file ?
Upvotes: 0
Views: 125
Reputation: 111306
Without using /etc/hosts it would be possible only if the DNS for mycomp.com
would have 127.0.0.1 in the A
record of the localhost.mycomp.com
subdomain - which is unlikely as that would be very insecure.
Other than that you could run a local name resolver that does that but this is basically just like using /etc/hosts but harder. Or you could route IP traffic for the IP that localhost.mycomp.com
resolves to (if it exists) to your own loopback or other local interface but that would be even harder.
Upvotes: 1