[ic] Force external image links to inherit page security
Dan Bergan
dan at berganconsulting.com
Wed Dec 5 23:18:20 UTC 2012
On Wed, Dec 5, 2012 at 12:03 PM, Paul Jordan <paul at gishnetwork.com> wrote:
>
> I am working on a system where I need to host images - mostly product
> images, in the cloud.
>
> Is there a (built in) mechanism to write plain ole http:// src's to the
> page, but have the page sense if it is being requested via https, and
> exchange any 'http' with 'https'? Or, is there perhaps a method to declare
> a variable twice, once for http requests and once for https requests? If so,
> then I could do:
>
> S3_IMAGES http://..... https://..... Cloud product images
>
> I realize I can use ImageDir and ImageDirSecure, but these are only singular
> solutions. I need to leverage a couple of these (as if I we're using
> multiple clouds). Obviously I can do a bunch of If-Secure-Else in all my
> pages, but I was hoping for something more elegant.
>
> Or if nothing else, has anyone needed to use multiple external asset hosts
> and deliver the same page(s) via http and https? What did you come up with?
>
> Worst case scenario, I can poor man it:
>
> [if type="explicit" compare="[is-secure]"]
> [tmpn ssl]s[tmpn]
> [else]
> [tmpn ssl][tmpn]
> [/else]
> [/if]
>
> <img src="http[scratch ssl]://foo.bar.jpg" />
>
> But... that seems like the old me :-)
>
I'm working on a very similar thing right now. Using Rackspace
Cloudfiles CDN, the URL is completely different for SSL compared to
just http (also, a different URL for each "bucket" -- thumbnails vs.
full images). So, I was thinking of doing an autoload routine to set
some scratch vars depending on the result of the is_secure tag. Then,
I will use those URLs for the images.
Dan
More information about the interchange-users
mailing list