This is a followup to #2455057: Fix fast 404 settings for private image files.
This issue summary is currently written using Drupal 7 terminology; I'm not quite sure how much it applies to Drupal 8.
We have a "404_fast_paths_exclude" variable in settings.php which is used to tell Drupal 7 to skip the "fast 404" behavior for image styles and private files.
However, as far as I can see, this only matters when drupal_fast_404() is called from settings.php (which is not the default behavior). In that case, Drupal acts under the assumption that if a request for e.g. an image actually reaches Drupal (meaning it wasn't on the filesystem and served by the webserver) then it must be a 404 not found. This assumption doesn't work for image styles and private files (which Drupal generates itself), thus they are excluded.
However, if drupal_fast_404() is not called from settings.php, Drupal only calls it itself when the menu system has finished processing and the page result actually is MENU_NOT_FOUND. As far as I can see, there is no need to exclude any paths from fast 404 processing in that scenario, since the Drupal menu system will have already served up the image style or private file before then, if the file exists from Drupal's perspective.
Therefore, we should consider changing the code so that "404_fast_paths_exclude" gets ignored in the above case, and only used in the settings.php case (or alternatively, for backwards-compatibility, add a new setting that does that instead).
Comments
Comment #2
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedComment #11
longwaveClosing as outdated, fast 404 is enabled by default in config and
drupal_fast_404()
was removed way back in #1831364: Inline drupal_fast_404() function