Using HTTPS Everywhere from Perl

Written 6 years ago by Mike Cardwell

HTTPS Everywhere is a project run by the Electronic Frontier Foundation. They have produced a Firefox addon which automatically converts requests from HTTP to HTTPS when possible. There is no safe way to automatically determine whether or not a request can be converted from HTTP to HTTPS, so they’ve been manually creating a list of rulesets for different websites. I wanted to take advantage of these rulesets from one of my Perl applications (this website), so I developed a module.

You can download the module from the public repository I set up on gitlab. You basically point it at the location of the rulesets and call a single method to convert URLs. Because the HTML of this website is generated using XSLT it was a simple matter of updating the framework to convert the href attribute of anchor tags. So if I link to the HTTP version of an external website which has an HTTPS ruleset, the URL will be dynamically converted to HTTPS when the HTML is built. The same will happen if somebody posts a comment with such a link.


I have created a Squid redirector script using the module. Now all of the apps on my LAN which perform HTTP requests are protected by the HTTPS Everywhere rulesets. I have added the script with instructions to the git repository.

You can follow this Blog using RSS or . To read more, visit my blog index.

Feeling generous?BitcoinMoneroZcashPaypal