[nmglug] serving HTTP content over HTTPS
Canton Becker
canton at gmail.com
Wed Oct 5 14:37:41 PDT 2016
From: "J. Marsden DeLapp" <jmdelapp at delapp.com>
> One little twist is that I have weather stickers (images) on my home
> page that come from http://weathersticker.wunderground.com and
> consequently that causes a warning that "parts of the page are not
> secure”.
I ran into this same problem when using mailchimp, which has a nice javascript snippet for displaying mail archives — but which can *only* be retrieved over HTTP.
I posted my PHP-based solution to this problem here:
http://cantonbecker.com/etcetera/2015/how-to-use-mailchimps-archive-js-code-if-your-site-is-ssl-encrypted/
You can adopt this work-around yourself. In your own PHP code, you use something like file_get_contents to retrieve your weather sticker content. Then you display it locally instead of via HTTP over the network. This way your web server retrieves the weather sticker via insecure HTTP, but everything between the server and the actual client looking at your web page is still encrypted.
For example, you could make a php file on your own server called ‘weatherimage.php’ and its code would be something like:
$remoteImage = "http://www.example.com/gifs/logo.gif";
$imginfo = getimagesize($remoteImage);
header ("Content-type: $imginfo['mime']");
readfile($remoteImage);
And then just <img src=“/weatherimage.php”> in your HTML.
That’s my $.02.
- Canton
--------------------------------------------------------------------
Canton Becker
canton at gmail.com • (505) 570-0635 • http://cantonbecker.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nmglug.org/pipermail/nmglug-nmglug.org/attachments/20161005/c8ea3453/attachment.htm>
More information about the nmglug
mailing list