Using wildcard domains to serve images without http blocking
- by iopener
I read that browsers sometimes block waiting for multiple images from the same host, and I'm trying to do everything I can to speed up page load times.
One caveat: I need to serve files over HTTPS.
Any opinions about whether this is feasible:
Setup a wildcard cert for *.domain.com.
Whenever I need an image, generate an number based on a hash mod 5 of the filename, and append it to an 'img' subdomain (eg img1.domain.com, img4.domain.com, img3.domain.com, etc.); the hash will make any filename always use the same subdomain, and therefore the browser should be able to cache the images
Configure a dynamic virtualhost record to point all img#. subdomains to /var/www/img
I am looking for feedback about this plan. My concerns are:
Will I get warnings when my page has https:// links to multiple subdomains?
Is the dynamic virtualhost record I'm talking about even possible?
Considering the amount of processing this would require, is it likely to even produce any kind of overall benefit? I'm probably averaging a half-dozen images per page, with only half being changed on each page refresh.
Thanks in advance for you feedback.