I have my website assets stored on Amazon S3 and served by CloudFront, from a separate domain name, to act as a cookie-less domain (so
website.com for the website and
websitestatic.com for static assets). I set a far ahead Expires header, so they can be cached by the browser.
Google PageSpeed recommends:
Parallelize downloads across hostnames. I can achieve this by adding subdomains pointing to the same CloudFront distribution and then randomize the URL to my assets, so I can have
My question is, will browsers recognize individual files as being the same as pre-cached ones, if they are served from different subdomains? As
media2, etc...all serve the same files, if over two page requests the same image was served from
media1 first, then
media2 next, will a browser recognize this or will it download it again?
I can randomize the subdomain URL in the HTML files that serves the file (
media8, etc...) but I can't store this random number for any particular file so that it is served from the same subdomain every time.
I'm guessing the answer is no, they won't, so if I was to implement random subdomains, I'd negate the advantage of having a cached version, as theoretically every page request you could get a different subdomain for the same file.