Secure downloads: 1st download works, downloads 2+ fail

  • Hey forum, hope you can help me solve this.

    I have a client website (standard Perch v3.1.7) with the Members App installed. I set up secure downloads as described in the docs (https://docs.grabaperch.com/ad…mbers/examples/downloads/).
    When there is more than one secure download displayed in a page, the first download initiated works as expected. Trying to start a second download, though, fails. The browser (Firefox on macOS in my case) reports “failed” (in the screencast “fehlgeschlagen” as it is German).

    When SHIFT-reloading the page (to purge the browser cache—no pun intended), the download of a second file works. Every try after that fails again.


    Here’s the screencast (MP4, 22s): https://zam.uber.space/sec-downloads.mp4

    At 00:15 the page is SHIFT-reloaded.


    I had this working before, but had to move servers, as the hosting company retired the old infrastructure.

    I checked the error logs and was in touch with the hosting provider, but there does not appear to be an issue with the hosting and/or server setup.

    Any ideas, how to attack this from a different angle, are appreciated.

    Cheers, Nils



    Here’s the (short) diagnostics summary:


  • The problem seems to have been (I will not hold my breath it will run smoothly for too long, as I had quite a few Perch-related issues with this project already), that I referenced the site’s root inside my download.php like this:

    PHP
    1. <?php
    2. $root = $_SERVER['DOCUMENT_ROOT'];
    3. include($root . '/perch/runtime.php');

    Changing that to the actual, relative path like so solved the issue:

    PHP
    1. <?php
    2. include('../../perch/runtime.php');

    I used the former on the old server without problems and still use it to include the /perch folder in all other pages. Only for the download.php file it broke functionality.