Link to home
Start Free TrialLog in
Avatar of AlexLuis
AlexLuis

asked on

SSL webpages displaying images from a non SSL domain

I have a classic ASP application and some of my pages are required to be https.
Since I am pulling some images displayed on these secured  pages from another external domain i get a an error because the images are coming from a non-secure conection.

Having the external domains to install a secure certificate is not an option for me right now.

Is there any way for me to 'read' the image on the server side and then use the Response object to output the same image from my secure connection instead of leeching directly from the other domain?
Avatar of RWJDCom
RWJDCom
Flag of United States of America image

There are two ways to do this.  First would be to copy all of the images that you are pulling from the other domain over to your own server that is SSL secured or you could create some sort of PHP script that is on your SSL domain that gets the images from the non-ssl domain.  

You would just call the script on your domain https://www.domain.com/get.php?image=<location_of_non_ssl_image>

I hope this works for you.
<?php
 
   $image = $_GET[image];
 
   $fp = fopen($image, r);
   $content = fread($fp, 100000);
   fclose($fp);
 
   header("Content-type: image/gif");
   header("Cache-control: public");
 
   echo $content;
 
?>

Open in new window

Avatar of AlexLuis
AlexLuis

ASKER

RWJDCom: As I mentioned before we have an AS site (VBScript) is there anyway we can do the same functionality from ASP (and not using PHP) ?
RWJDCom: Copying all the images is not an option either, this is a dynamic application and the images are updated in a daily basis.

Thanks
AlexLuis: There's most definately a way to do it in ASP but as I do not know ASP someone will need to convert my code to ASP.  All you need to do is have the script grab the image file from the current location and display it on your page.  I'm sorry I couldn't be of more assistance but the method above WILL work if you can get it converted to ASP.  I will see what I can come up.
ASKER CERTIFIED SOLUTION
Avatar of ourman1974
ourman1974

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial