• hi. when i make a download with EDD, i have 2 option for the download link of the file (the file that i try to sell it): a) upload file in UPLAODS directory of wordpress and b) insert download link that hosted in other servers or paths.
    by first way, download link is protected and has been changed, so users can not read real file URL. but for external download links, Url in not protected, acctually its changed, but at the end step (when user click on link) , it redirects to main URL so every 1 can access to real URL and acctualy expiration is unusefull. so,
    how could i protect my external file URLs?
    i want downloads be like woocommerce (no matter what link you give to it, it will be protected for costumers).
    thanks a lot.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @ramin009,

    When files are hosted externally it is not possible for EDD to restrict the files. The reason for this is simple: the files are not on the server that EDD is on and so it cannot hide them. All EDD can do is send customers to that file’s location to download it.

    The only way to protect externally hosted files is to use a service like Amazon S3 that we integrate with through a developer API they offer to generate one-time, secure download links. See our extension for a good option: https://easydigitaldownloads.com/downloads/amazon-s3/

    Thread Starter ramin009

    (@ramin009)

    acctually, i live in god damn iran and like many services, we can not purchase services from other countries easily.
    however, thank you for quick answer.
    just 1 thing, i wonder woocommerce can do it some how, so im certain its possible. but as i realized, you just dont want it, right?
    you know, many people prefer EDD for digital products. its easy ,simple and powerfull. if there was only 1 thing to make it in disaddventage , its that problem. i just wanna you know about this .
    and i do continue with EDD, and try to bring my files in the host . good luck and thanks again.

    I’ve looked into the source code for WooCommerce and they handle remote files the same way we do. Here’s the code that is used for remotely hosted files in WooCommerce:

    
    /**
     * Redirect to a file to start the download.
     *
     * @param string $file_path File path.
     * @param string $filename  File name.
     */
    public static function download_file_redirect( $file_path, $filename = '' ) {
    	header( 'Location: ' . $file_path );
    	exit;
    }
    

    That code instructs the browser to redirect to the $file_path (the URL of the file). That’s the same behavior EDD uses.

    It’s possible there’s an additional configuration for WooCommerce that handles remote files differently but I’m not seeing it. Do you happen to have that set up somewhere such that you could show me?

    Thread Starter ramin009

    (@ramin009)

    sure. i have made 2 free product with woo and EDD. you can see the results in this image :
    https://bayanbox.ir/view/8545358913401746456/0001.png (please zoom on that)
    main file url is:
    https://bayanbox.ir/download/633644638131816808/5102.zip
    and my site url is: ebook.gixx.ir
    the address of file (that hosted in bayanbox.ir ) is accesable with EDD (after purchase). but not with woo.
    you can test it personally by purchasing this file in address below:
    https://ebook.gixx.ir/product/test-woo-prod/
    https://ebook.gixx.ir/downloads/download-with-edd/

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘protect external file URL’ is closed to new replies.