News for hackers. Stuff that matters.
Re:Why use www? by forgotpasswd3x on Saturday January 30, 2016 @10:05PM (#11005049)
I think that www vs. no-www, as a matter of "putting the customer first" is so INCREDIBLY insignificant, compared to the thousands of other decisions that go into a product, that it's ridiculous we're even having this conversation. This is looking for optimization in the wrong places at its finest.
Re:Why use www? by lkrubner on Sunday January 31, 2016 @03:24PM (#11007893)
Do you a think a user should have to write:

http://www.apple.com:80/

or:

http://www.apple.com/

Ever since the first web browsers, way back in the early 1990s, it has been commonplace to leave out the port number. The web browser adds it automatically.

Similar logic would lead us to leave off the "http". And similar logic would lead us to leave off the "www". The trend has been to simplify the URL as much as possible.

Re:Why use www? by ldjb on Sunday January 31, 2016 @03:35PM (#11007933)
Nobody is suggesting the user should be forced to type in the protocol, the subdomain, or the port number. If the user types in:

apple.com

It should lead to where the user wants to go.

However, there are good reasons for using the www subdomain as the canonical URL, and it is also worth noting that some users will habitually type in www anyway.

If you don't want to include the subdomain in marketing material, then there's nothing stopping you from leaving it out, just as there's nothing stopping you from leaving out the protocol.

Re:Why use www? by dalore on Tuesday February 02, 2016 @03:56AM (#11018339)
And even just typing:

apple

Should lead to where they want to go.

Re:Why use www? by rootkea on Tuesday February 02, 2016 @01:55PM (#11021523)
Which leads to 127.0.53.53 on Iceweasel 38.5.0 https://www.icann.org/namecollision
Re:Why use www? by geofft on Sunday January 31, 2016 @03:38PM (#11007943)
From the article:

Should I redirect no-www to www?

Yes.

Redirection ensures that visitors who type in your URL reach you regardless of which form they use, and also ensures that search engines index your canonical URLs properly.

So I don't think you're advocating anything they don't.

Re:Why use www? by efaref on Sunday January 31, 2016 @07:51PM (#11008943)
Annoyingly, this can be difficult to do if the A record for your domain doesn't point to a webserver. There are other legitimate things it could point to, like an authentication domain controller or a session border controller. Do you really want to be running a webserver there, even if it's only redirecting?
Re:Why use www? by geofft on Monday February 01, 2016 @07:46AM (#11011419)
I'm not familiar with session border controllers, but DCs can be and usually are placed somewhere at the apex of the domain, via SRV records.

If you really have trouble, you can tell your firewall to route ports 80 and 443 to another machine and everything else to the device you need. (I've run a hackier version of this that used netcat inside inetd: we didn't want a web server on the machine that owned the domain name, but there was another nearby web server cluster that we added a virtual host to. And we were fine running inetd and netcat on the machine.)

Re:Why use www? by seanp2k2 on Monday February 01, 2016 @03:13PM (#11015022)
I've done something similar but using iptables and dnsmasq to route DNS differently depending on where the requests were coming from and what domain they were asking about.
Re:Why use www? by devishard on Sunday January 31, 2016 @10:04PM (#11009417)
Your argument that eliding the www is better for users is logical, but you failed to make any argument whatsoever that it is significant. Given that you were responding to a statement that the difference isn't significant, you're basically attacking a straw man.
Re:Why use www? by brownbat on Sunday January 31, 2016 @08:26AM (#11006314)
> www vs. no-www, as a matter of "putting the customer first" is so INCREDIBLY insignificant

I don't know, I've always been fascinated by the premium of domains that are just one character shorter, and all of the startups that exclude a vowel to get a compressed (or maybe just available) name. That could reflect actual user preferences.

UX theorists convinced me over the last decade that user behavior is shaped by tiny moments and irritations that we think are insignificant at first glance. A few 100 ms extra in delays may seem barely perceptible, but they can kill a site. It's not implausible that a few extra keystrokes could do the same.[0]

On the other hand, redirects seem like a happy medium, so long as they're fast enough. nasa.gov uses a redirect, that seems fine. Note that they were driven to that (from 'www'-only) after confused fans kept writing in to complain that "http://nasa.gov" was a dead end and that they didn't "even know the basics of running a website."[1]

[0] https://www.nngroup.com/articles/response-times-3-important-... N.B.: In that link, Jakob Nielsen recommended making "www" optional through redirects. It's been a while, so not sure his current thoughts, but the same reasons would apply today. https://www.nngroup.com/articles/compound-domain-names/

[1] https://blogs.nasa.gov/nasadotgov/2011/05/31/post_1306860816... NASA's case provides a real example of something Jakob Nielsen pointed out in the first link: usability is a slave to expectations. So if enough popular sites are using naked domains, and your naked domain just 404s, some users will dismiss your site as unreliable.

Re:Why use www? by baby on Sunday January 31, 2016 @12:10AM (#11005312)
I was going to write the exact same thing as you. But then I thought about Chrome removing "http://" to avoid displaying useless and dense information to the user. What about www?
Re:Why use www? by LeoPanthera on Sunday January 31, 2016 @01:52AM (#11005537)
That would be misleading as example.com and www.example.com are not guaranteed to be the same site.
Re:Why use www? by cdubzzz on Sunday January 31, 2016 @07:55AM (#11006243)
You could say the same for http:// and https://.
Re:Why use www? by awalGarg on Sunday January 31, 2016 @08:42AM (#11006345)
I don't think chrome (or any browser) removes https:// from url bars. They only remove http://.
Re:Why use www? by cdubzzz on Monday February 01, 2016 @08:03AM (#11011482)
Ah you're right! For some reason I had it in my head that Chrome was hiding that. I really just hate that it hides any part of the full URL.
Re:Why use www? by kuschku on Sunday January 31, 2016 @09:19AM (#11006453)
Doesn’t safari mobile do that?
Re:Why use www? by TheCoreh on Sunday January 31, 2016 @02:07PM (#11007516)
Safari desktop as well.
Re:Why use www? by wyqydsyq on Sunday January 31, 2016 @04:57PM (#11008282)
No you couldn't, with http vs https you are accessing the exact same resource, just through a different protocol.
Re:Why use www? by betenoire on Sunday January 31, 2016 @05:31PM (#11008454)
Not necessarily. I've written my share of rewrite rules that change behavior based on https vs http.

Imagining that were true, you would never be redirected to an https version of a page.

Re:Why use www? by kevinschumacher on Sunday January 31, 2016 @06:04PM (#11008591)
Well, if the org hosting the content is being nice and following convention, sure.

But, there's nothing stopping me from running a webserver listening on port 80 (so, accessed in the browser at http://example.com) that serves a picture of a baseball. I can also run a webserver listening on port 443 only (with SSL/TLS set up, so accessed in a browser at https://example.com), on the same machine, that serves a picture of a dog instead.

This sort of breaks the rules/conventions though because you expect the resource to be the same by nature of the URL you're using to access it. But nobody has to follow that rule

Re:Why use www? by jessaustin on Sunday January 31, 2016 @06:12PM (#11008620)
That's one way to set it up, but there's no guarantee of that. Servers may switch anything based on TLS status or really any other property of a client request.
Re:Why use www? by plaguuuuuu on Sunday January 31, 2016 @07:50PM (#11008942)
I agree with this. The people saying it's technically possible to get a different webpage at that resource address are missing the point - it's trivial to do A/B with the same site, same port, same protocol, based on user IP, time of day or a RNG.

The point of URL is to identify a single address owned by one guy. Removing the www subdomain means you have two addresses, possibly owned by two guys.

Re:Why use www? by effie on Sunday January 31, 2016 @07:03PM (#11008781)
The protocol name is part of the URL, so it is possible and technically valid that the https version leads to different content than the http version. Some things are certainly different, for example if there are ads and other linked resources on the https page, they all need to go through https, while on http page, there is no such requirement.
Re:Why use www? by codeddesign on Sunday January 31, 2016 @02:08AM (#11005585)
Technically I guess you could make it a subdomain but no one would actually do that in a production site and in my 14 years have never seen it used, not to mention that major search engine bots will lookup both. The general user will simply type in the domain name more times than not without the www
Re:Why use www? by jonhohle on Sunday January 31, 2016 @02:39AM (#11005642)
`www` used to literally be a different host in a network (and in some cases, I'm sure still is) specifically designated for WWW traffic. Think of universities in the 90s which had their existing infrastructure and an Internet facing host on their primary domain and they want to add a web server. They may have had a firewall, probably no load balances, so routing port 80 around their primary host was much more complicated than just throwing up a new host and DNS entry.
Re:Why use www? by detaro on Sunday January 31, 2016 @05:07AM (#11005902)
I regularly come across sites that only work with "www.". Common with university sites that use the subdomain hierarchy a lot. For extra fun, make the behavior reversed depending on if you are inside or outside their network.
Re:Why use www? by kuschku on Sunday January 31, 2016 @09:18AM (#11006448)
Same with my uni. And then you have sites that only work with, and others that only work without the www.

But it makes sense. the first subdomain before the uni domain specifies the faculty, many of which have their own datacenters. Then many of those have yet their own servers in their network, and often www. is one added later on.

Re:Why use www? by thesimon on Sunday January 31, 2016 @07:30AM (#11006200)
My uni makes this extra fun with different sites on http and https.
Re:Why use www? by detaro on Sunday January 31, 2016 @11:11AM (#11006782)
Oh yeah. And then someone enables HSTS and a subdomain doesn't support HTTPS, so now you have to keep a browser around that never ever is allowed to contact the parent site...
Re:Why use www? by saurik on Sunday January 31, 2016 @02:59AM (#11005680)
Apple actually does this on the iPhone.
Re:Why use www? by lkbm on Sunday January 31, 2016 @07:46PM (#11008925)
I know IE used to do this too.
Re:Why use www? by x5n1 on Saturday January 30, 2016 @10:17PM (#11005073)
A redirect is also completely invisible to the user, and should only add a few microseconds to the page load. But you should always redirect www. if you are not using www. Many people instinctively type that into the address bar when you tell them a domain name.
Re:Why use www? by jjoonathan on Saturday January 30, 2016 @11:43PM (#11005255)
A few microseconds, huh? I decided to do some experiments. Here's how long some 301s on common sites took:

    google.com:    529ms
    apple.com:     261ms
    microsoft.com: 142ms
    reddit.com:     61ms
Which is not only 100,000 times longer than a few microseconds but more importantly well above the perception threshold.
Re:Why use www? by buzzdenver on Sunday January 31, 2016 @12:02AM (#11005297)
Where in the world are you that google.com's 301 takes over half a second ? It's under 100ms for me.
Re:Why use www? by jrockway on Sunday January 31, 2016 @12:52AM (#11005411)
I don't get the parent's numbers either. I did:

    $ time (curl -L www.reddit.com > /dev/null 2>&1)
    real	0m0.410s
    user	0m0.040s
    sys	0m0.008s

    $ time (curl -L reddit.com > /dev/null 2>&1)
    real	0m0.389s
    user	0m0.036s
    sys	0m0.012s
So for Reddit, I'm going to make the cost of the redirect 21 milliseconds.
Re:Why use www? by jjoonathan on Sunday January 31, 2016 @10:25AM (#11006649)
I cleared Firefox's cache, opened the waterfall diagram, and looked at the time between when I hit enter (assuming that's 0ms) and the time when the request for the www.* address went out. I was planning to subtract off DNS time if necessary but in all cases it hit the cache and contributed 0ms.

I didn't have wireshark open so I don't really know what happened with google. It surprised me too. Maybe something had to be re-transmitted? Now it seems to take 90-100ms. Perhaps I should have done best-of-three, but my point wasn't about precise numbers, it was about orders of magnitude, and "tens to hundreds of ms" is definitely more in line with what I expected than "a few us".

Re:Why use www? by wangman on Sunday January 31, 2016 @09:54AM (#11006573)
This is because reddit.com and www.reddit.com gets you the http-versions, which both are redirected to https

Try this: curl -sL https://{www.,}reddit.com -o\ /dev/null{,\ } -w "%{time_redirect}\n"

Re:Why use www? by buzzdenver on Sunday January 31, 2016 @10:32AM (#11006669)
Can I ask you to explain that "-o\ /dev/null{,\ }" magic ?
Re:Why use www? by drostie on Sunday January 31, 2016 @11:12AM (#11006783)
It's not magic -- it's some form of crude error.

So first off what this does is, it expands to the expression:

    '-o /dev/null' '-o /dev/null '
Even if we remove the latter space by just using `{,}` instead of `{,\ }` curl still returns for me an error code 23 -- CURLE_WRITE_ERROR.

curl seems to interpret `'-o /wtf'` as a command to write to the file ` /wtf`, so this only makes sense if you have a directory called ` ` in the folder you're running from.

You can therefore do this correctly with:

    -o/dev/null{,}
and that correctly writes the contents to /dev/null without issuing a curl write error.
Re:Why use www? by wangman on Sunday January 31, 2016 @12:45PM (#11007129)
Thanks, it sure looks less ugly with -o/dev/null{,} I couldn't find any other way to get curl to stay silent and still output redirect times. Hence the crude hack. (Obviously my bash and curl versions had no problem with the spaces or I wouldn't have posted it)
Re:Why use www? by d0ugie on Sunday January 31, 2016 @04:34PM (#11008186)
Using the curl'ing tips up this branch of comments I programmed a highly sophisticated script and dropped it on github. :)

https://github.com/dougsimmons/301debate

Re:Why use www? by wangman on Sunday January 31, 2016 @05:41PM (#11008504)
Nice!

I would have gone for a simpler loop:

echo -e "sec\tmethod\turl";for url in {https,http}://{www.,}{en.wikipedia.org,{google,reddit,facebook,youtube,netflix,amazon,twitter,linkedin,msn}.com,google.co.in}; do curl -sL "$url" -w "%{time_redirect}\t${url%:}\t${url#//}\n" -o/dev/null; done|sort

Re:Why use www? by d0ugie on Sunday January 31, 2016 @06:31PM (#11008681)
Wow. Thanks for teaching me that. Yeah, yours is better, I'll lay it on github with a thank you and maybe "embrace and extend" it.

Or learn python and port it to python, I could swing it that way.. Cheers.

Re:Why use www? by negus on Sunday January 31, 2016 @04:48AM (#11005868)
you're calculating load time the wrong way - you should not do time check outside the process as you do calling 'time' as another process from shell. consider using curl profiling option next time
Re:Why use www? by derFunk on Sunday January 31, 2016 @05:14AM (#11005919)
With `time` you also calculated the process time curl needs to evaluate the 30x response and the reissued http request to www.
Re:Why use www? by Nemo157 on Sunday January 31, 2016 @06:24AM (#11006064)
Which is valid since this processing time will be included in whatever application the user is using to access the website.
Re:Why use www? by derFunk on Sunday January 31, 2016 @09:16AM (#11006441)
I'm aware I'm nitpicking and maybe too theoretical now, but the processing time would vary in whatever application the user is using.. I'm with negus here who basically means the same I guess. The generic danger here (regarding benchmarking) is that you're explicitly also benchmarking curl. In case curl/"the web client" would handle 30x redirects super inefficiently, these results could lead to wrong assumptions.
Re:Why use www? by manigandham on Sunday January 31, 2016 @01:34AM (#11005503)
There are plenty of places in the world where internet latency is a big issue, not to mention mobile networks everywhere. There's no reason to add a roundtrip unless absolutely necessary.
Re:Why use www? by elithrar on Sunday January 31, 2016 @01:02AM (#11005434)
In most cases it should stay low too: your browser should retain a keep-alive to the web server, so you're not throwing away the connection.

Future requests will auto-resolve due to caching of the 301.

Re:Why use www? by lukeschlather on Sunday January 31, 2016 @11:03AM (#11006757)
Mediocre Wifi can easily add seconds of latency.
Re:Why use www? by otterley on Sunday January 31, 2016 @11:55AM (#11006950)
HTTP/301 redirects are "permanent" per the RFC, and therefore cacheable. Subsequent requests for the apex zone by the user should cause the browser to skip the first request entirely.
Re:Why use www? by x5n1 on Saturday January 30, 2016 @11:57PM (#11005285)
touche.
Re:Why use www? by jbverschoor on Sunday January 31, 2016 @01:14AM (#11005458)
And this is EXACTLY why you should use www.
Re:Why use www? by manigandham on Sunday January 31, 2016 @01:33AM (#11005499)
microseconds? That's definitely not the case. It takes 10s of milliseconds just to leave your internet router on busy wifi home networks. A 301 redirect is an extra network roundtrip for no gain and much more (perceived) latency.
Re:Why use www? by codeddesign on Sunday January 31, 2016 @02:15AM (#11005601)
that is actually false. The majority of people no longer type in www. For example, in the last 10 years branding has completely remove the www and so likewise user reaction has followed suit. Unless you are targeting an older crowd, the vast majority ignore www on a search. With chrome being the major browser now and with browsers allowing search from the address bar, lookup without www is pretty much standard - again assuming your users are in a class of under 35 years of age.
Re:Why use www? by detaro on Sunday January 31, 2016 @05:11AM (#11005910)
"many people" != "the majority". Having the site not work with www. would be very stupid.