I've noticed the same pattern for the contents of /etc/hosts
for a long time (don't remember when I first noticed it).
The file always contains the following 2 entries:
- 127.0.0.1 localhost
- 127.0.1.1 ${HOSTNAME}
What I don't know is the rationale behind having the two distinct IP addresses, rather than having only the one shared address. I remember using the form
- 127.0.0.1 localhost ${HOSTNAME}
decades ago in a multinational corporate environment.
Some explanation is given in this ServerFault posting, which then points to this Debian Manual Page, but it still doesn't address the need for the two to be distinct, instead of being shared.
Does anyone know for sure?
The main thing is that, for specifying a "local" host web address in a software configuration file, should I be using
- https://localhost:${portNum}/${pathToFile}
or
- https://${HOSTNAME}:${portNum}/${pathToFile} ?
The below text is not directly related to my primary issue/concern stated above.
( === START of "suppressed" posting === )
Summary
Also of note, using "localhost", there is no "security" issue.
However, using ${HOSTNAME}, Firefox is reporting a security issue:
and further details offered:
Correction: I had omitted the required "s" for https, so there is no discrepancy in behaviour between the use of localhost or ${HOSTNAME}, but I am still getting a report of "not secure", likely because I did not personally configure any security.
( === END of "suppressed" posting === )