- 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...
- First commit to issue fork.
- 🇺🇦Ukraine zviryatko
So the issue is related to core change - https://www.drupal.org/node/3346038 → , provided a fix, need testing.
- 🇨ðŸ‡Switzerland znerol
Thanks for the hint. I'm going to add a test case to the MR which should adequately cover the issue.
- Merge request !5Issue #3470250: Error 404 not found for protected files (images) → (Merged) created by znerol
- 🇨ðŸ‡Switzerland znerol
Also found 📌 Pass the session when forwarding to image style controller Active while reviewing the image style forwarding code.
-
znerol →
committed 332389cb on 2.x
Issue #3470250: Error 404 not found for protected files (images)
-
znerol →
committed 332389cb on 2.x
- 🇨ðŸ‡Switzerland znerol
I manually verified the cause and the fix. I'm confident that the MR is correct. Thanks @mxt for the detailed report and @zviryatko for the Fix. Also sorry I did not react earlier. I honestly had no idea what could cause this.
- 🇺🇦Ukraine zviryatko
> I honestly had no idea what could cause this.
It was the core change - https://www.drupal.org/node/3346038 → , preview simply returns 503 error with some stack trace.
Proxying image previews with sub-request is very tricky, I've been working on https://www.drupal.org/project/cdn/issues/3179753 ✨ Improve far-future support: generate dynamically generated files automatically (f.e. image style derivatives) Needs work some time ago, and it has more problems than I expected. Btw, using cdn + cdn_cloudfront_private was an alternative in my case when existing website had many public file fields and it was just too complex to move them to private and use drupal for giving the file response, instead I kept all files public but protected it to be accessible only by cloudfront, no one else can't, and CF signed cookie did the trick. But that's aws only solution.
- 🇨ðŸ‡Switzerland znerol
It was the core change
Exactly. Once you pointed that out to me it was clear, but I had difficulties to understand the problem before that point in time.
An automated test would have caught that early on. Now there is one, so I'm confident that similar issues with image styles will
Rolled a release and shipped the fix in 2.1.1 → .
- 🇮🇹Italy mxt Milan
I'm very sorry to reopen this: I tried 2.1.1 but the issue is still there.
I'll rewrite here the nginx error, because it is the only feedback I have.
NGINX error when uploading the image:
nginx_1 | 2024/11/28 20:42:10 [error] 46#46: *39 open() "/var/www/html/web/protected-download/protected/67523e80/jwOPk2rK5-8oX0zpl7vDAwOiZ8_6eHEILcpfFFH7RHo/styles/thumbnail/protected/2024-11/myImage.png.webp" failed (2: No such file or directory), request: "GET /protected-download/protected/67523e80/jwOPk2rK5-8oX0zpl7vDAwOiZ8_6eHEILcpfFFH7RHo/styles/thumbnail/protected/2024-11/myImage.png.webp?itok=DAd52Bxn HTTP/1.1",
So it seems that nginx cannot find the file...
- 🇨ðŸ‡Switzerland znerol
Nginx shouldn't try to open this file. It should pass the request to Drupal.