HISE Logo Forum
    • Categories
    • Register
    • Login

    Facing product download dilemma/issues

    Scheduled Pinned Locked Moved Solved General Questions
    18 Posts 5 Posters 631 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ustkU
      ustk
      last edited by ustk

      Hey guys,
      I am setting up my system so my (future) customers can download their products using my manager app.
      All is good and works on the app side, but... I have some questions about security, especially the kind of attack using a script to download your stuff hundreds of time and shut down your site (and also php injection).

      • I created a download folder in the website's root called, yep, downloads and place my products in that folder (as well as some release info, etc...). I give my wordpress product the link, and all is good and working from the manager app. But this approach seems risky to me as there's no verifications like bearer token, etc... So first question, am I right to assume this?

      • The other approach I am trying is to place the product in the WP Media library, and, since this directory (.../wp-content/uploads/woocommerce_uploads/...) is natively protected against all kind of attacks, it feels safer to me (hey guys, pardon me, I have no knowledge in web dev). But then with this approach, the manager app can't download the product from this link, obviously. Second question, is there a way to use a header of some kind (like the JWT token) or any parameters withe the Server.downloadFile() API to allow a user to download from this location without compromising the website?

      • Third question, and now I think about it I probably should have started with this one, maybe using an external specialised storage service would simplify my life and resolve all those silly questions... ? (and remove the loads from the main server)

      Can't help pressing F5 in the forum...

      d.healeyD A gorangroovesG 3 Replies Last reply Reply Quote 0
      • ustkU
        ustk
        last edited by

        Alright guys, so finally Bunny CDN has an API for the storage part with secure/unique download link generation, so I go with it. (might not be the best but it's not the question for now, and since I will probably never have big sample based instruments but more DSP stuff, the size does not matter 😉

        Can't help pressing F5 in the forum...

        gorangroovesG 1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey @ustk
          last edited by d.healey

          @ustk said in Facing product download dilemma/issues:

          created a download folder in the website's root called, yep, downloads and place my products in that folder

          Are your products really small? Otherwise that's a lot of bandwidth for your website server to handle. Usually you'd want to offload that to a CDN, I use S3 because there is a convenient WooCommerce plugin, but there are cheaper options. ... and I just saw your third question :)

          So what I do is I use WooCommerce, that handles the download permissions and generates secure links to S3. I made a custom WP plugin for my site that handles the connection between Rhapsody and WooCommerce.

          So when a user places an order they get download links and a license key, all generated by WooCommerce, the S3 plugin, and the license manager plugin.

          Then in Rhapsody I get them to log into my WP site using the JWT auth plugin. From Rhapsody I then query the end points of my custom plugin to see if they have a valid license when they click the download button. If they do I send a request to WooCommerce to generate a fresh S3 link.

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          ustkU clevername27C 2 Replies Last reply Reply Quote 2
          • A
            aaronventure @ustk
            last edited by

            @ustk Consider hosting your files elsewhere. S3 or Backblaze (a lot cheaper than S3). Then use the API to generate links on request.

            You don't need a full blown server, you just need a cloud function (AWS Lambda, Azure Cloud Functions, Google Functions) that will have its own API endpoint (automatically generated once you set it up). You call it, the function does the work (check in database for user credentials, fetch download link from backblaze, then returns the link). That way you only pay as much as you use, with a generous free traffic (I think AWS Lambda has 2mil. free calls a month).

            1 Reply Last reply Reply Quote 1
            • gorangroovesG
              gorangrooves @ustk
              last edited by

              @ustk I have not tried your approach, so I can't advise on such a procedure. However, I can recommend the Digital Ocean's CDN. It is extremely easy to use, affordable and there is a plugin that integrates with WooCommerce.

              What @d-healey explained here sounds very good to me if you are utilizing a download manager. As an extra precaution, you can set the maximum number of downloads per product in WooCommerce to, say, 5. Then, if someone needs more, you can manually regenerate download links for them. That would prevent someone from downloading hundreds of times.

              Goran Rista
              https://gorangrooves.com

              Handy Drums and Handy Grooves
              https://library.gorangrooves.com

              d.healeyD 1 Reply Last reply Reply Quote 1
              • d.healeyD
                d.healey @gorangrooves
                last edited by

                @gorangrooves said in Facing product download dilemma/issues:

                there is a plugin that integrates with WooCommerce.

                Tell me more

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                gorangroovesG 1 Reply Last reply Reply Quote 0
                • ustkU
                  ustk @d.healey
                  last edited by ustk

                  @d-healey @aaronventure @gorangrooves Thanks guys! That's indeed what I needed to hear...
                  As for the licensing part, it is all done and working using a php plugin I've made.
                  So really the only thing I need is generating a the fresh link for identified users.

                  I will check the different storage solutions/CDNs you gave me in the next days to see which one fits my workflow the best. I tried Bunny CDN last week (just for the automated site acceleration part, not third party storage) and it was catastrophic for my website. I am not saying Bunny was the cause of the poor loading response by itself, but maybe more CDNs in general. Through this little journey I learned that almost no websites need a CDN and people often think it will help while in reality it doesn't (I've read this from different sources)
                  So since I only need a storage, a CDN might not be relevant to me (except if they offer separate pricing tiers so I don't use the habitual acceleration)

                  Can't help pressing F5 in the forum...

                  gorangroovesG 1 Reply Last reply Reply Quote 0
                  • gorangroovesG
                    gorangrooves @d.healey
                    last edited by

                    @d-healey The plugin is:

                    Link Preview Image
                    Upload Your WordPress Media to Amazon S3 with WP Offload Media - Delicious Brains Inc

                    Speed up your WordPress site by offloading your media to Amazon S3, DigitalOcean Spaces or Google Cloud Storage. Watch a full demo and see how it works.

                    favicon

                    Delicious Brains (deliciousbrains.com)

                    It automatically transfers all of your uploaded content from the website over to the CDN and updates the website links to pull assets from the CDN. You can offload any assets from the CDN to be served from your website.

                    For software distribution, I upload files directly to the Digital Ocean CDN. Unlike Amazon's ridiculous barrage of settings, it is as simple as "private or public" for any file. I set them to "public," as no one actually sees the direct links. The WP plugin, in conjunction with WooCommerce, creates unique links on the fly. The links expire as soon as they are used, but new ones are generated as soon as the user clicks on the download button.

                    When setting WooCommerce products, I use the CDN endpoint links for each product. You are provided 3 links for each uploaded file by the DO CDN: origin, CDN, and subdomain endpoints.

                    The WP Offload Media can also be used with Amazon.

                    Goran Rista
                    https://gorangrooves.com

                    Handy Drums and Handy Grooves
                    https://library.gorangrooves.com

                    1 Reply Last reply Reply Quote 1
                    • gorangroovesG
                      gorangrooves @ustk
                      last edited by

                      @ustk a CDN should be helpful since files are distributed to several "edge" locations around the world and get served to end users from the location closest to them.

                      The CDN plugin I mentioned here works great. I use it to serve all images, videos, and products from the CDN.

                      Make sure your website uses HTTP2 protocol, as multiple resources get served at the same time, as opposed to one-by-one, thus speeding up your website.

                      Goran Rista
                      https://gorangrooves.com

                      Handy Drums and Handy Grooves
                      https://library.gorangrooves.com

                      ustkU 1 Reply Last reply Reply Quote 0
                      • clevername27C
                        clevername27 @d.healey
                        last edited by

                        @d-healey Another vote for S3

                        gorangroovesG 1 Reply Last reply Reply Quote 0
                        • gorangroovesG
                          gorangrooves @clevername27
                          last edited by

                          @clevername27 Have you tried the Digital Ocean CDN?

                          Goran Rista
                          https://gorangrooves.com

                          Handy Drums and Handy Grooves
                          https://library.gorangrooves.com

                          clevername27C d.healeyD 2 Replies Last reply Reply Quote 0
                          • clevername27C
                            clevername27 @gorangrooves
                            last edited by

                            @gorangrooves I have not, no.

                            gorangroovesG 1 Reply Last reply Reply Quote 0
                            • gorangroovesG
                              gorangrooves @clevername27
                              last edited by

                              @clevername27 Then your vote doesn't count. Sorry. 😂

                              Goran Rista
                              https://gorangrooves.com

                              Handy Drums and Handy Grooves
                              https://library.gorangrooves.com

                              1 Reply Last reply Reply Quote 0
                              • ustkU
                                ustk @gorangrooves
                                last edited by

                                @gorangrooves yeah I understand the principle of CDNs and this is exactly why I jumped into it when realising the slowness of my website. Then after some tests and readings, I realised that only a few specific websites actually need one, and the fact that it is cached in several places is in the end not a good argument (which is weird to hear at first, I agree) A good optimisation of the website is way better than a CDN with a "natively messy and not optimised wordpress" website.

                                Can't help pressing F5 in the forum...

                                gorangroovesG 1 Reply Last reply Reply Quote 0
                                • gorangroovesG
                                  gorangrooves @ustk
                                  last edited by

                                  @ustk A CDN is not going to compensate for other shortcomings. It should be used in conjunction with and as part of the overall optimization process. I recommend running the tests and checking out the recommendations in browser dev tools.

                                  I've done a fair amount of this over the years. The most critical things that make the biggest impact are the size of images, caching of everything that can be cached, GZIP compression, lazy load of images and videos, and HTTP2 protocol. Of course, a good server is very important.

                                  Years ago, before I delved into all of this, I was working on a website and wondering why it was taking ages to load (50 sec). Then I realized my images were like 1.5MB each 😂 Once I brought them down to 120KB each and implemented the other optimizations, the website has been loading instantly ever since.

                                  Goran Rista
                                  https://gorangrooves.com

                                  Handy Drums and Handy Grooves
                                  https://library.gorangrooves.com

                                  1 Reply Last reply Reply Quote 1
                                  • d.healeyD
                                    d.healey @gorangrooves
                                    last edited by

                                    @gorangrooves said in Facing product download dilemma/issues:

                                    Digital Ocean CDN

                                    The price looks to be the same as S3 so I'm not sure I see an advantage to using it, other than not having to deal with AWS stuff (but I already have that set up and use it for mail too).

                                    Libre Wave - Freedom respecting instruments and effects
                                    My Patreon - HISE tutorials
                                    YouTube Channel - Public HISE tutorials

                                    gorangroovesG 1 Reply Last reply Reply Quote 0
                                    • gorangroovesG
                                      gorangrooves @d.healey
                                      last edited by

                                      @d-healey For you, if you are already on S3 and set up, there would be no advantage.
                                      For somebody new, the advantage of it is that it is a lot simpler and easier to use.

                                      I use both for a couple of websites I run, so I am able to compare them.

                                      Goran Rista
                                      https://gorangrooves.com

                                      Handy Drums and Handy Grooves
                                      https://library.gorangrooves.com

                                      1 Reply Last reply Reply Quote 1
                                      • ustkU
                                        ustk
                                        last edited by

                                        Alright guys, so finally Bunny CDN has an API for the storage part with secure/unique download link generation, so I go with it. (might not be the best but it's not the question for now, and since I will probably never have big sample based instruments but more DSP stuff, the size does not matter 😉

                                        Can't help pressing F5 in the forum...

                                        gorangroovesG 1 Reply Last reply Reply Quote 0
                                        • ustkU ustk has marked this topic as solved on
                                        • gorangroovesG
                                          gorangrooves @ustk
                                          last edited by

                                          @ustk yeah, that's what she said. 😂

                                          Goran Rista
                                          https://gorangrooves.com

                                          Handy Drums and Handy Grooves
                                          https://library.gorangrooves.com

                                          1 Reply Last reply Reply Quote 1
                                          • First post
                                            Last post

                                          10

                                          Online

                                          1.7k

                                          Users

                                          11.8k

                                          Topics

                                          102.4k

                                          Posts