Error 404 not found for protected files (images)

Created on 26 August 2024, 3 months ago

Problem

The server returns a 404 error for files (images) managed by protected downloads, even if images are correctly uploaded in the protected directory: see the attached animation.

My settings:

Protected directory location:

MyProject
-- config
-- protected-files  <- Here
-- web
---- core
---- modules
---- [and so on with default Drupal dirs]




Protected directory path setting:

$settings['protected_download_file_path_protected'] = $app_root . '/../protected-files';




Default download method:




Caching




Upload Destination (field_images)



NGINX errors:

NGINX error when uploading the image:

nginx_1      | 2024/08/26 09:40:06 [error] 48#48: *209 open() "/var/www/html/web/protected-download/protected/66d10b80/9NmU8NGnltNWQaoucK7BMgJKlVah_Zz0vUXBQwRUOqE/styles/thumbnail/protected/2024-08/MY-IMAGE.jpg.webp" failed (2: No such file or directory), client: 192.168.144.6, server: default, request: "GET /protected-download/protected/66d10b80/9NmU8NGnltNWQaoucK7BMgJKlVah_Zz0vUXBQwRUOqE/styles/thumbnail/protected/2024-08/MY-IMAGE.jpg.webp?itok=KCsTCxxj HTTP/1.1", host: "dev.itabots.com", referrer: "http://dev.itabots.com/node/2/edit"




NGINX error when viewing the node:

nginx_1      | 2024/08/26 09:40:13 [error] 48#48: *209 open() "/var/www/html/web/protected-download/protected/66d10b80/f2BsT2bKtj8K7qyEZyrLvDt79mImN3rKL4IWy825-yA/2024-08/MY-IMAGE.jpg" failed (2: No such file or directory), client: 192.168.144.6, server: default, request: "GET /protected-download/protected/66d10b80/f2BsT2bKtj8K7qyEZyrLvDt79mImN3rKL4IWy825-yA/2024-08/MY-IMAGE.jpg HTTP/1.1", host: "dev.itabots.com", referrer: "http://dev.itabots.com/node/2"




Any suggestion to fix the problem is appreciated, thank you.

💬 Support request
Status

Active

Version

2.0

Component

Code

Created by

🇮🇹Italy mxt Milan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mxt
  • 🇮🇹Italy mxt Milan

    Just to do a test, I tried to setup the default Drupal $settings['file_private_path'] stuff with a path similar to the one setted for $settings['protected_download_file_path_protected'] (so both dirs are at the same level), and this works fine: image styles are correctly created, and images are visible in the node.

    So it seems that there is something wrong with paths or the custom stream wrapper implemented by this module.

  • 🇮🇹Italy mxt Milan

    I also tried to set these default drupal settings just to see if this can help:

    $settings['file_additional_public_schemes'] = ['protected'];
    $settings['file_sa_core_2023_005_schemes'] = ['protected'];
    

    But the problem is still there...

Production build 0.71.5 2024