A question about Localhost with Safari

Michael Crawford mdcrawford at gmail.com
Sat Jan 3 23:21:52 PST 2015


HTTP 1.0 used only the IP address; if you wanted a single server to
serve multiple domains, it needed to have multiple IP addresses.

HTTP 1.1 permits the use of the hostname, and a single IP that
multiple hosts all share.

However, in general it should work to leave off the hostname.  What
you'd get is the the default host's website.

I myself use "warplife.frylock" as the domain for my website when I
work on it locally.  I have Apache configs for each of my hosts -
presently only that one but at times I have more than one.  Here I'm
counting on the ".frylock" not being a real TLD, however TLDs have
been proliferating lately.

MIke
Michael David Crawford, Consulting Software Engineer
mdcrawford at gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Sat, Jan 3, 2015 at 11:06 PM, William H. Magill <magill at mac.com> wrote:
> On Jan 3, 2015, at 3:41 PM, William H. Magill wrote:
>>
>>> Did Apple change something in Yosemite/Safari so that "localhost" is no longer an accessible DNS address for Safari?
>>>
>>> I have no trouble ssh-ing to localhost on my system, but Safari always responds  "Can't connect to the Server."
>>>
>>> Note that at one time I was using Apple's Apache via OSX Server, but have since replaced that with MacPorts.
>>> And, I have no idea if  "localhost" worked after I upgraded to Yosemite and OSX Server ceased operation.
>
> Interesting set of replies (below).
>
> What triggered my query was the fact that various "how to" pages describe using "localhost" as a mechanic for testing certain web based services -- which did not work!
> https://trac.macports.org/wiki/howto/Apache2
> I'm guessing that the over-arching description that one can define "ServerName localhost:80" is simply no longer an "appropriate" statement for OSX and Yosemite. And apparently for Apache2 in general -- it works and passes validation, but the results of its use are not predictable.
>
> It also appears that the function of the ServerName directive has changed. The current Apache manual http://httpd.apache.org/docs/2.2/mod/core.html#servername
> describes its syntax as requiring a FQDN -- which neither Localhost nor IP address constructs (127.0.0,1) really are.
> (Apparently the directive is directly related to various DOS, Virtual Host and other DNS issues and is supplanted by the results from "gethostname" C function.
> http://httpd.apache.org/docs/2.2/dns-caveats.html
>
> In short, it appears that the old "localhost" shortcut needs to disappear from the documentation. For no other reason than the fact that results from using it are not reproducible.
>
> I hate documentation which states "do X for result Y" -- only to get result Z when you do so!
>
> All of which is compounded by the fact that while Yosemite "will work" if you are not connected to the Internet, Apple has structured things such that Yosemite EXPECTS to be connected to the Internet, i.e "the iCloud."
>
> On Jan 3, 2015, at 7:45 PM, Ryan Schmidt <ryandesign at macports.org> wrote:
>>
>> I experience the problem on Yosemite that "localhost" will randomly switch between accessing the IPv4 address of my server (which works) and the IPv6 address of my server (which apparently isn't working). I've had to start using "127.0.0.1" instead, which is the IPv4 address. This does not appear to be specific to Safari; I saw it in the terminal with curl too.
>
> On Jan 3, 2015, at 7:49 PM, Richard L. Hamilton <rlhamil at smart.net> wrote:
>>
>> You might try
>>
>> http://127.0.0.1/
>> and
>> http://[::1]/
>>
>> (IPv4 and IPv6 addresses for localhost - use https and a port number if required)  If neither of those works either, it's probably not the hostname lookup (which is not necessarily just DNS, depending on how you're configured).
>>
>> Safari should be able to look up localhost from other than DNS (/etc/hosts or local OpenDirectory storage, I think) anyway..
>
> On Jan 3, 2015, at 7:51 PM, Dave Horsfall <dave at horsfall.org> wrote:
>>
>>
>> I've seen it in Firefox from time to time, when my MacBook's FF refreshes
>> itself against the pages on my FreeBSD server (which happens to support
>> IPv6 as well, but it shows in the Apache logs).
>
> On Jan 3, 2015, at 8:00 PM, René J.V. Bertin <rjvbertin at gmail.com> wrote:
>
>> I experience the problem on Yosemite that "localhost" will randomly switch between accessing the IPv4 address of my server (which works) and the IPv6 address of my server (which apparently isn't working). I've had to start using "127.0.0.1" instead, which is the IPv4 address. This does not appear to be specific to Safari; I saw it in the terminal with curl too.
>
> I had similar issues a long time ago already, already back in October 2006 I commented out the line with the IPv6 localhost address in /etc/hosts. I've never noticed any side-effects, and using IPv6 when you're behind a router that probably assigns addresses from a private netblock like 192.168.0.0/16 is completely unnecessary.
>
> I've never tried, but it might be enough to deactivate IPv6 support in the Network Location settings if you prefer not to touch /etc/hosts.
>
>
> T.T.F.N.
> William H. Magill
>
> magill at icloud.com
> magill at mac.com
> whmagill at gmail.com
>
>
>
>
>
>
>
>
> _______________________________________________
> macports-users mailing list
> macports-users at lists.macosforge.org
> https://lists.macosforge.org/mailman/listinfo/macports-users


More information about the macports-users mailing list