Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Forbidden error 403 when downloading

    Thought I had the downloads working--it's showing up in the download manager, customer can order, cart says it's available for download but when you click on Download Now, you get an error 403. Both the download directory and the file itself are set to 0755.

    I see what part of the problem is--zencart is looking for it in the 'pub' directory rather than the download directory. But I moved the file to the pub directory and I still get the 403 Forbidden error message.

    Here is the url that's being generated. I have no idea where the subdirectory name after pub is coming from.

    http://www.newnaturalsonline.com/pub...directions.pdf

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Forbidden error 403 when downloading

    Zen Cart offers multiple styles of serving downloads.

    It "could" do the old-school way of just making every file downloadable from whatever place you actually upload it ... and then all your customers can share that link with their friends so nobody else has to "buy" it anymore. But most storeowners aren't in the business of giving all their paid downloads away for free.

    So, the default method is to serve downloads "by redirect", which causes the server to:
    - wait for order to be paid
    - when the download link is clicked, it makes a new temporary folder the /pub/ directory with a random name starting with "." (because dot-prefixed files/folders are generally treated as "hidden" by most operating systems)
    - then it makes a symlink to your product's download file into that temporary folder
    - then that is what serves the file when the customer clicks the link
    --- and before actually serving the file it checks whether the link has been used more than the allowed number of times you configured when you set it up in the Attributes Controller ... and if they've downloaded it too many times it denies access.

    Another method is to download by "chunking" ... which is useful for extra-large files if the redirect method is having memory problems on the server. Same approach is used for authorizing the download, but the symlink is bypassed.

    Possible causes of your problem:
    - server doesn't support symlinks. This is rare nowadays, as most reliable servers support symlinks now. It's usually old servers that can't handle this.
    -- the symlink issue could be a PHP version limitation (windows servers are still catching up)
    -- the symlink issue could be an apache rule configuration that's preventing symmlinks from being honored, even though Zen Cart comes with an .htaccess file that tells it to honor symlinks (could be master apache config overriding it)
    - your PHP and/or filesystem configuration might be disallowing files to be created under the pub folder (permissions issue)

    Alterates:
    - Try changing to download-by-streaming/chunking (Admin Configuration Attributes)
    - Or, if neither of those more secure methods work, you could set downloads to go Direct ... but then you have no security or authorization control.

    Several FAQs address the subject. Here's one: Download delivery methods explained
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Forbidden error 403 when downloading

    One other possible cause or variation on one of the above, the symlink that is created to redirect to the download file is provided the wrong access rights (0777 by default ZC in includes/modules/pages/download/header_php.php instead of 0755).

    It's something I often have to change on the more "public" servers.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Re: Forbidden error 403 when downloading

    Thanks, both of you. I didn't know about symlinks. I did manually change the directory and file permissions, but I'll go back with this info and do some more checking. The product is free and the number of accesses is set to some ridiculously high number, so neither of those should be an issue.

  5. #5
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Re: Forbidden error 403 when downloading

    I fixed it for the time being by changing the settings to streaming. This is a smallish file and it's free, so I don't need some of the restrictions provided by the redirect. I'll have to figure this out at some future time when we start charging for another planned download, but for the moment, the problem is solved. Thanks for your help.

 

 

Similar Threads

  1. 403 Forbidden error when updating product
    By pinixdesign in forum Setting Up Categories, Products, Attributes
    Replies: 28
    Last Post: 27 Mar 2012, 05:10 AM
  2. '403 Forbidden Error' when trying to download product
    By rlfreshwater in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 13 Sep 2008, 08:45 PM
  3. Forbidden error when downloading purchased digital products.
    By HaHo in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 17 Apr 2007, 10:38 PM
  4. 403 Error when downloading
    By sparktronic in forum Managing Customers and Orders
    Replies: 10
    Last Post: 8 Jun 2006, 05:19 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR