I'm trying to implement the following scenario:
- Host downloadable product on AmazonS3
- Make S3 files private (not accessibile by direct url)
- Enable access if Referrer is mywebsite
If I try to point on a webpage to product url, referrer il trasferred and download start but if I try to buy a product and to use the url autogenerated by magento, I get "not authorized" error from Amazon S3.
I think that the problem is that Referrer header are not set, is there a way to add this to download link?
Edit 28/12: I tried to debug download url and I have the following result:
Request URL:***mydomain***/downloadable/download/link/id/MC41MTUzODgwMCAxNTEzNzYxNDk4MjEzMTg1NjU1Nw,,/ Request Method:GET Status Code:302 Remote Address:***** Referrer Policy:no-referrer-when-downgrade
I think that the problem is Referrer Policy. How can I change it? I tried to edit Download.php class as following with no success
$headers = 'GET ' . $path . $query . ' HTTP/1.0' . "\r\n" . 'Host: ' . $urlProp['host'] . "\r\n" . 'User-Agent: Magento ver/' . Mage::getVersion() . "\r\n" . 'Referrer-Policy: origin' . "\r\n" . 'Connection: close' . "\r\n" . "\r\n"; fwrite($this->_handle, $headers);