• Resolved caro93

    (@caro93)


    Hello! I’d like to ask for some guidance since I’m stuck.

    To be honest, I’m not a developer nor anything alike, I’ve set up personal sites before using wordpress and I love it. This is the first time I’m setting up a Woocommerce store (for myself as well) and the product are digital downloads.

    This is where I’m stuck. In these Woo tutorial (https://docs.woocommerce.com/document/digital-downloadable-product-handling/) it is said that there are 3 methods to upload your files and the most secure one is the X-Accel-Redirect/X-Sendfile.

    I’ve already checked with my hosting service (siteground) and they’ve told me it is supported and the have configured everything in they servers for me as a client being able to use it.

    The thing I am not getting (and the question) is… When everything is set up (in this case the code the tutorial says and everything have been done) I just upload the files on the media section of my wordpress site and that’s it?? Or do I need to upload them somewhere else??

    I’m very confused and I haven’t being able to find oriental information in internet.

    Thanks in advance!!

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Mirko P.

    (@rainfallnixfig)

    Hi @caro93,

    When everything is set up (in this case the code the tutorial says and everything have been done) I just upload the files on the media section of my wordpress site and that’s it?? Or do I need to upload them somewhere else??

    Thanks for your questions relating to the downloadable products.

    When everything is set up on the server and it’s confirmed the X-Accel-Redirect/X-Sendfile module is installed and enabled, you will simply select the corresponding download method under WooCommerce > Settings > Products > Downloadable products and choose among the files (or upload) in the Media Library for your digital product:


    Link to image: https://i.imgur.com/9HLFXhR.png

    Link to image: https://i.imgur.com/s8XxGJu.png

    This way the downloadable files will be served directly from the server to the customer.

    You could also use external cloud storage in case you reach the allowed storage limit on your host. WooCommerce only needs an external URL that points to your digital download file. If it is a valid external download URL, then WooCommerce works perfectly.

    I hope this helps!

    Thread Starter caro93

    (@caro93)

    Oh, thank you so much! I was getting really confused about this, now is clear. Thanks!

    Plugin Support abwaita a11n

    (@abwaita)

    You’re welcome @caro93!

    Glad to hear that @rainfallnixfig’s explanation was helpful!

    If you have any other questions, feel free to create a new thread.

    Cheers!

    Following up on what has been mentioned by Abwaita, I have a question with regards to hosting the files on an external server:

    I have installed Woocommerce on top of WordPress which is installed on a shared hosting plan which, according to what the hosting company has told me, runs on Litespeed and does not have x-sendfile installed.

    I host my files on an external server which has Nginx and everything set up, including x-sendfile and X-Accel-Redirect and here’s what I do:

    I add the links to the files that are hosted on the external Nginx server and have the download method set as x-dendfile/X-Accel-Redirect on woocommerce. When a user clicks on the download link for a downloadable product, the download starts at full speed but there are a couple things I’ve notice that have caused me to have questions:

    1. On Woocommerce I have unchecked the “Allow using redirect mode (insecure) as a last resort “. So, I know the file is not served through the redirect method.

    2. When the download starts, I can’t see the file size of the file which is being downloaded. This happens also with when I activate Force Download.

    All the information above, has caused to me have the following questions:

    If I activate the x-sendfile when the “Allow using redirect mode (insecure) as a last resort ” is deactivated, and if in this case the file can be downloaded, does this mean that it’s working perfectly well? or am I missing something?

    Because according the Woocommerce documentation, the host needs to have x-sendfile and from that, I understand that by hosting they mean the hosting on which wordpress is installed needs to have x-sendfile whereas in my case, my external server has Nginx and x-sendfile.

    • This reply was modified 3 years, 2 months ago by jahanaria.

    If I activate the x-sendfile when the “Allow using redirect mode (insecure) as a last resort ” is deactivated, and if in this case the file can be downloaded, does this mean that it’s working perfectly well? or am I missing something?

    As long as the file download itself is working (and it sounds like it is), then I don’t think you’re missing anything. I’d just keep an eye out for customer reports that downloads aren’t working. So unless you hear something about it, I would assume that things are working OK. ??

    Because according the Woocommerce documentation, the host needs to have x-sendfile and from that, I understand that by hosting they mean the hosting on which wordpress is installed needs to have x-sendfile whereas in my case, my external server has Nginx and x-sendfile.

    Yes, I think our documentation assumes that in the majority of cases, the file downloads will be hosted on the same server as the site. That’s not the case for you of course, but still, it sounds like things are working great with your external nginx server, so you should be good.

    Let us know if there’s anything else we can help with! ??

    Thank you for your reply @adamkheckler, I ran a few tests to see if the entire thing works just fine today, and here’s what happened:

    I activated the x-dendfile/X-Accel-Redirect download method on Woocommerce, and left the “Allow using redirect mode (insecure) as a last resort” unchecked. Tried downloading files as large as 400MB and the first couple tests worked just fine, but the third and the fourth tests failed. Also, it was not possible to pause/resume an ongoing download.

    I’m currently working on some PHP script to create an indirect download link off of the external Nginx server in order to make up for the lack of security for the redirect only method.

    I’ll do my best to fill you in on what’s going to happen next.

    I activated the x-dendfile/X-Accel-Redirect download method on Woocommerce, and left the “Allow using redirect mode (insecure) as a last resort” unchecked. Tried downloading files as large as 400MB and the first couple tests worked just fine, but the third and the fourth tests failed. Also, it was not possible to pause/resume an ongoing download.

    This is starting to get into a networking sort of territory, which is where my expertise is a bit shaky, but my understanding is that once the download has begun from the external server, WooCommerce itself really plays no role from that point on.

    There could be any number of things that would cause a download to stop:

    – Momentary network drops local to your machine.
    – Network problems between your machine and the download server.
    – Automated systems on the download server ending downloads, e.g. bandwidth limits/monitoring.
    – etc.

    There could be any number of factors involved there, and since we can only really help with WooCommerce itself, I’m not sure how much we can really assist here. My thinking, again, is that once the download is started, WooCommerce isn’t really involved at all at that point.

    Anyway, I hope you can find something that works for you. Please let us know if you think WooCommerce itself is somehow at fault here.

    Thanks!

    Ah, one thing I should add though: if indeed you think WooCommerce itself is causing this, it may be best to start your own thread in this forum, since this one is technically Resolved. We like to stick to a single issue per thread.

    Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘X-Accel-Redirect/X-Sendfile Question’ is closed to new replies.