HTTP to HTTPS PHP Proxy Script – Photobucket Embedded Gallery

Photobucket Embedded Gallery HTTPS Support – PHP Proxy Script

Edit: Apr 2019 – Photobucket has updated their site, and HTTPS is now supported properly with embedded galleries! Hurrah!

It has been a tough few years for photobucket’s reputation…

In 2017 they launched their new paid “P500” plan, holding millions billions of images on the web to ransom and demanding $400 per year, which unsurprisingly, didn’t go down well...

For a recent website, I needed to use photobucket because they offer an email-to-upload service that filled a specific need. While I was able to find alternative solutions, I decided to give photobucket one more chance.

Photobucket Embedded Gallery iframe

Photobucket offers an embedded photo gallery service, that uses an iframe to load a small gallery on your website with very little effort. While iframe’s are old school, many of the security issues they have been plagued with have been addressed over time too, and they tend to me more reliable and robust than javascript library based solutions.

However, I could not get the Photobucket Gallery iframe to load. I checked the browser debugger and saw that I was getting errors about mixed content – this is due to the host website using HTTPS security, and the iframe content being sent over unsecured HTTP, and thus the browser decides to not display it. Surely this is an easy problem to solve? Photobucket didn’t have any answers of what to do, but some searching indicated that Photobucket claim that they do support HTTPS:

Screenshot from the photobucket website help center…

 

Unfortunately when I modified the iframe source to use HTTPS the gallery still refused to load. Contacting their support team indicated that no, Photobucket only supports HTTPS for individual images, and does not support HTTPS for the gallery embedder.

So, what to do? Do I give up?

The workaround solution I came up with was to create a basic HTTPS upgrade proxy script, using PHP. This script requests the gallery resources from Photobucket via HTTP, and then serves them to the client over HTTPS.

This script does several things

  • fetches the script content over cURL, and passes on both the content of the file and the MIME type
  • parses the content, and automatically edits the URL addresses in the HTML to point to the proxy server.
  • made specific modifications to the live proxied javascript files to handle the change of domains
  • passed the changed content to the web browser client over HTTPS

I’m willing to pass on my Photobucket HTTPS proxy PHP script to those who are interested – just leave a comment below and I will email you the script.

If this script helps you, there is the option to buy me a chai in the sidebar on the left.

Leave a Reply

Your email address will not be published. Required fields are marked *