Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 235261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:15:06+00:00 2026-05-11T20:15:06+00:00

First, a bit of background info: The HTTP 1.1 specification, circa 1999, recommends that

  • 0

First, a bit of background info:

The HTTP 1.1 specification, circa 1999, recommends that browsers and servers limit parallel requests to the same hostname to two. (more)

If you carry on reading that article the author suggests “fooling” browsers by having multiuple subdomains all pointing to the same thing.

If I was to serve my images from two separate subdomains (two different hostnames) then the browser would download a maximum of 4 images in parallel (2 per hostname).

Given that, I could now equally spread out the requests between the two subdomains to optimise page download speed, like so:

<img src="http://subdomain1.example.com/img1.jpg" />
<img src="http://subdomain2.example.com/img2.jpg" />
<img src="http://subdomain1.example.com/img3.jpg" />
<img src="http://subdomain2.example.com/img4.jpg" />

This would require me to manually go through the appropriate files and change the ‘src’ of each image.


I’m looking for a far more simple/reusable solution that involves no visible changes to the HTML.

I have an idea:

  1. All image-like URLS on [example.com] are redirected (via .htaccess) to [example.com/imghandler.php]
  2. imghandler.php redirects to either subdomain1 or subdomain2 – randomly chosen.

To illustrate:

# Request from browser:
>> http://example.com/dir/image.jpg

# Rewritten to:
>> http://example.com/imghandler.php?location=%2Fdir%2Fimage.jpg

# *Redirects* to either:
    1:
        >> http://subdomain1.example.com/dir/image.jpg
           (this is where the browser ends up getting the image from)
    2:
        >> http://subdomain2.example.com/dir/image.jpg
           (this is where the browser ends up getting the image from)

I have two questions:

  1. From a theoretical point of view, would this work?
  2. Is there a better way of accomplishing what I want?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:15:06+00:00Added an answer on May 11, 2026 at 8:15 pm

    One thing to keep in mind with strategies like this is you want to direct the requests for the same file to the same server. It doesn’t do much good to have requests for:

    http://subdomain1.example.com/img1.jpg
    http://subdomain2.example.com/img2.jpg
    http://subdomain1.example.com/img3.jpg
    http://subdomain2.example.com/img4.jpg
    

    On one page then:

    http://subdomain2.example.com/img1.jpg
    http://subdomain1.example.com/img2.jpg
    http://subdomain2.example.com/img3.jpg
    http://subdomain1.example.com/img4.jpg
    

    On the next.

    The trick we use here is to hash the file name (GetHashCode in C#) and use that to choose a bucket:

    var serverNumber = image.GetHashCode() % serverCount;
    

    This ensures that further requests for the same image are served from the browser’s cache and not by a different server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A bit of background first: GeoModel is a library I wrote that adds very
First a bit of background. I have been working on the MS platform for
A bit of background first: I am using base code from a remote SVN
First off, there's a bit of background to this issue available on my blog:
I understand that the first bit is the sign and that the next 8
I need to outline a little bit of background info for context. Please bear
First a bit of background: I have a WPF application, which is a GUI-front-end
First a little bit of background: I have a REST service in WCF 4
Just a bit of background first. I currently have a site hosted with Windows
A bit of background first. I am finding the eigenvalues and eigenvectors of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.