13
2
I have a linux test machine which I would like to run a copy of a production webserver. This is a legacy application which does not use a property file for its server name. Throughout the application, the server name is hardcoded (example: open connection to myServer.myCompany.com).
Is there any linux trick which I can use to redirect all requests for a certain host back to localhost? I know in Windows that I can add an entry to the hosts file and have it redirect back to localhost. How do I do this in linux?
I did exactly that on Debian 8 Jessie. And it aint work:
host workflows.devbg.us
returnsHost workflows.devbg.us not found: 3(NXDOMAIN)
. – Boris Burkov – 2016-04-06T10:15:59.397Will that work if myserver.mycompany.com is sometimes referenced by http and other times with https? Even with different ports (besides 80)? – somebody – 2010-06-01T20:20:20.737
1Yes, it will. You're only specifying what IP myserver.mycompany.com resolves to. It doesn't matter what service you're connecting to on that IP. /etc/hosts is at OSI layer 3, the services are a layer 4 construct. – baumgart – 2010-06-01T21:54:45.963
1It's well known that nslookup/host don't look at /etc/hosts. Try pinging the host, it should give you the proper IP. Or try using a browser to hit it. – baumgart – 2016-04-12T17:09:03.470