'Getting squid to cache a http request that needs to be redirected to a https request

I have an odd situation. I've got code that requests data from http://machine.com/datafile. machine.com redirects to an https address, but otherwise leaves things the same.

I'd like squid to cache these requests. I'd need to setup squid (or something) so that when it sees a request to http://machine.com/datafile it actually gets the data from https://machine.com/datafile (transparently, without a local redirect).

Is a configuration like this possible?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source