Server responded with 403

Created on 15 July 2023, 12 months ago
Updated 16 July 2023, 12 months ago

Problem/Motivation

Since a change in how the module File (Field) Paths work (due to new version in Dec '22 β†’ ) the TinyPNG module has stopped working. It seems to me, a non-technical site-builder that the reason is that since the files now recide in a folder for private files, TinyPNG can't access the temporary file, and thus can't do the magic it is supposed to.

Steps to reproduce

Use a setup where TinyPNG works with File (Field) Paths.
Set a private path in Drupal.
Make File (Field) Paths user the private files folder for temporary files.

This gives error mesages such as
Path: /system/files/filefield_paths/kodak-image.png. Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException: in Drupal\system\FileDownloadController->download() (line 92 of /home/www/web/core/modules/system/src/FileDownloadController.php).
and
Server responded with 403. (HTTP 400/Source not found)

Does anyone have a solution to this?

Kind regards,
Adam

πŸ’¬ Support request
Status

Postponed: needs info

Version

1.2

Component

Code

Created by

πŸ‡ΈπŸ‡ͺSweden AdamEvertsson

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

Comments & Activities

  • Issue created by @AdamEvertsson
  • Status changed to Postponed: needs info 12 months ago
  • πŸ‡­πŸ‡ΊHungary tikaszvince

    How do you exactly use these modules?
    What is your TinyPNG module (/admin/config/tinypng) configuration? Is the "Compress on upload" enabled? Is "Integration Method" value is "Download" or "Upload"?
    Is your File field path is configured to use the private:// path?
    How your image field exactly configured?
    When does this error usually appears?

  • πŸ‡ΈπŸ‡ͺSweden AdamEvertsson

    Thank you for a quick reply. You're awesome!

    How do you exactly use these modules?
    I have several content types with image fields (I'm not using the Media library on these fields, to be extra clear). On every field TinyPNG used to shrink the uploaded images.

    What is your TinyPNG module (/admin/config/tinypng) configuration? Is the "Compress on upload" enabled? Is "Integration Method" value is "Download" or "Upload"?
    Download.

    Is your File field path is configured to use the private:// path?
    Yes. The settings at admin/config/media/file-system/filefield-paths is set to private://filefield_paths and in settings.php I use a path to a folder outside the www, chmodded to 777.

    How your image field exactly configured?
    It's set up the most standard way possible. The only addition is the File Field Paths which I use to change the filename based on information in other fields on the content type.

    When does this error usually appears?
    On every image upload. The watchdog log says "access denied", and then renders the message Path: /system/files/filefield_paths/image.png. Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException: in Drupal\system\FileDownloadController->download() (line 92 of /home/kulhisto/domains/reklamfranforr/www/web/core/modules/system/src/FileDownloadController.php). which makes me think that the awesome TinyPNG-module and service can't access the image due to access restrictions.
    The image gets uploaded allright, and a thumbnail is shown, but the image doesn't get shrunk via TinyPNG.

Production build 0.69.0 2024