Download links from S3 not working for purchases

I'm having a problem downloading files that we have purchased using MarketPress.
We've done two purchases, and the download links are going out with the emails properly, but the links never go to the ZIP file downloads.

The admin page for the order shows the file has not been downloaded, either. No error messages are

The files are being hosted on Amazon S3, and have been made available for download (We saw another error when the file hadn't been made public)

I have just tried this with the file linking to another public server, with a JPG instead of the ZIP, and this worked. Both files should be accessible through the links being used.

  • Alexander
    • DEV MAN’s Mascot


    It sounds like the link is changing from the time it is sent to the user.
    Can you give an example of a direct link to a file on S3? (maybe just a dummy file uploaded to S3) Anything that you can just enter in your browser now and receive the file from amazon.

    If you'd like to do this privately, just send it to me through the contact form. Include my name in the subject "Alexander Rohmann" and a link back to this thread as well.

    Also, what happens when you click the link in an email? Does it go anywhere?

    Finally, can you confirm you're using the latest version of MarketPress for me? (v 2.8.8)

    Best regards

  • grahamlindsey
    • Design Lord, Child of Thor

    Thanks for the response!

    Email sent with a MarketPress download links, as well as an Amazon S3 link.

    I updated to 2.8.8, and it didn't change the behaviour.

    When the download links are clicked on, there is a long wait/loading before the product page of the ordered product shows up, with no download starting, and no indication of a download link on the product page.

  • Alexander
    • DEV MAN’s Mascot


    I've looked into this, and it has to do with the file size. By default, MarketPress will retrieve a copy of the file first, then serve that file to the user. The entire file would be copied into the server's memory.

    What you will need to do, is enable large downloads. You can do this by adding the following to your wp-config.php file.


    This will have the user download the file from S3 directly. This is less secure, because you're doing a redirect, but will get the job done.

    Best regards

  • grahamlindsey
    • Design Lord, Child of Thor

    Interesting - when it was taking a while to load, I wondered if it had to do with the size of the file.

    Can I ask if this means the user will see the file URL in the browser when downloading? This might not work for us, as the files that are currently being served are a series of albums, and the current SKUs (Which we're naming them with) will quickly reveal how to download the other files.

    This would also give the user a direct link to the file that they can bypass the download limit with.

    If these files are not bigger than 200MB, is it possible to set it up so that the entire file can be loaded into memory? This might be a question for our webhost, but it's also good to know that MarketPress/Wordpress will allow this, too.

  • Alexander
    • DEV MAN’s Mascot


    Yes, the user will be sent to the direct URL. So someone smart could turn this around.

    I wouldn't recommend having your server work with large files like this. This will slow down your site for other users, and create more bottlenecks - it will also use up twice as much bandwidth as you'll be paying S3 for the download as well as using bandwidth with your host.

    Now, what I would recommend is pursuing a deeper Amazon S3 integration. The S3 API allows you to create what is called a pre signed URL. Then you could filter the MarketPress download URL to allow this to happen

    For example, you could create a plugin containing this:

    function mp_s3_download($url, $order, $download) {
        $url = ... Code to create pre-signed URL based on current URL
        return $url;

    The AWS SDK allows for pre-signed URLs to easily be created based on your AWS accessID and secret.

    This would require custom development, but would be the best approach here.

    Best regards

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.