We have a site which is accessed entirely over HTTPS, but sometimes display external content which is HTTP (images from RSS feeds, mainly). The vast majority of our users are also stuck on IE6.
I would ideally like to do both of the following
- Prevent the IE warning message about insecure content (so that I can show a less intrusive one, e.g. by replacing the images with a default icon as below)
- Present something useful to users in place of the images that they can’t otherwise see; if there was some JS I could run to figure out which images haven’t been loaded and replace them with an image of ours instead that would be great.
I suspect that the first aim is simply not possible, but the second may be sufficient.
A worst case scenario is that I parse the RSS feeds when we import them, grab the images store them locally so that the users can access them that way, but it seems like a lot of pain for reasonably little gain.
Your worst case scenario isn’t as bad as you think.
You are already parsing the RSS feed, so you already have the image URLs. Say you have an image URL like
http://otherdomain.example/someimage.jpg. You rewrite this URL ashttps://mydomain.example/imageserver?url=http://otherdomain.example/someimage.jpg&hash=abcdeafad. This way, the browser always makes request over HTTPS, so you get rid of the problems.The next part – create a proxy page or servlet that does the following –
This solution has some advantages. You don’t have to download the image at the time of creating the HTML. You don’t have to store the images locally. Also, you are stateless; the URL contains all the information necessary to serve the image.
Finally, the hash parameter is for security; you only want your servlet to serve images for URLs you have constructed. So, when you create the URL, compute
md5(image_url + secret_key)and append it as the hash parameter. Before you serve the request, recompute the hash and compare it to what was passed to you. Since the secret_key is only known to you, nobody else can construct valid URLs.If you are developing in Java, the Servlet is just a few lines of code. You should be able to port the code below on any other back-end technology.