Problem/Motivation

The fast_404system allows a shortcut path, which is by default configured to asset extensions like txt, png, swf, etc.

One case which is not covered currently is the case of source maps for CSS and JS, which are requested when developers have browsers with dev tools open, and which cause extra 404s all going to the Drupal backend (hopefully cached if cache_ttl_4xxis active).

Since these are assets, present or not, these requests should not have to go to the router if fast_404 has been set up, just like the other asset types.

See the MAP file format wiki page for more information.

Steps to reproduce

Proposed resolution

The fast_404 extensions are currently txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp.

Add map to the list of extensions.

Remaining tasks

  1. Create patch
  2. Review patch
  3. Commit patch

User interface changes

API changes

Data model changes

Release notes snippet

Comments

fgm created an issue. See original summary.

fgm’s picture

Status: Active » Needs review
StatusFileSize
new901 bytes

Tiny patch addressing the issue.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

kristen pol’s picture

Version: 8.9.x-dev » 9.1.x-dev
Issue tags: +Bug Smash Initiative

Patch applies cleanly to 9.1.x.

kristen pol’s picture

The change looks like it would address the problem noted in the issue summary but I'm not sure if there is an easy way to test this manually.

kristen pol’s picture

Status: Needs review » Needs work
Issue tags: +Novice

Moving back to needs work because there are a few other places that need updating. Here are all the places that have the extensions defined:

./core/modules/system/config/install/system.performance.yml:  paths: '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i'
./core/modules/system/tests/src/Kernel/Migrate/d7/MigrateSystemConfigurationTest.php:        'paths' => '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i',
./core/modules/system/tests/src/Kernel/Migrate/d6/MigrateSystemConfigurationTest.php:        'paths' => '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i',
./core/assets/scaffold/files/default.settings.php:# $config['system.performance']['fast_404']['paths'] = '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i';
./sites/default/default.settings.php:# $config['system.performance']['fast_404']['paths'] = '/\.(?:txt|png|gif|jpe?g|css|js|map|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i';
bthompson1’s picture

StatusFileSize
new3.68 KB
kristen pol’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: 2987864-fast404-map-9.patch, failed testing. View results

jaykandari’s picture

Issue tags: +DIACWAug2020
kunal_singh’s picture

Assigned: Unassigned » kunal_singh
kunal_singh’s picture

StatusFileSize
new4.56 KB
kunal_singh’s picture

Assigned: kunal_singh » Unassigned
Status: Needs work » Needs review
kristen pol’s picture

Issue tags: +DCCO2020

Reviewing this for DrupalCamp Colorado.

kristen pol’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Thanks for the update. Marking RTBC since:

1) Patch still applies cleanly to 9.1.x.

2) Tests pass.

3) Migrate tests include map now.

4) After applying the patch, there are no places in core missing map after txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp

./core/modules/system/config/install/system.performance.yml:  paths: '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp|map)$/i'
./core/modules/system/tests/src/Kernel/Migrate/d7/MigrateSystemConfigurationTest.php:        'paths' => '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp|map)$/i',
./core/modules/system/tests/src/Kernel/Migrate/d6/MigrateSystemConfigurationTest.php:        'paths' => '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp|map)$/i',
./core/assets/scaffold/files/default.settings.php:# $config['system.performance']['fast_404']['paths'] = '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp|map)$/i';
./sites/default/default.settings.php:# $config['system.performance']['fast_404']['paths'] = '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp|map)$/i';

5) Title and issue summary are clear.

6) Note: updated the issue summary to use the template, change some minor formatting, and add link to https://en.wikipedia.org/wiki/MAP_(file_format) for reference.

larowlan’s picture

We have no tests for that subscriber that I can see?

Can we get a follow-up task to add tests for the fast_404 behaviour?

The class was added in #2323759: Modularize kernel exception handling

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 14: 2987864-14.patch, failed testing. View results

naresh_bavaskar’s picture

Assigned: Unassigned » naresh_bavaskar
naresh_bavaskar’s picture

Assigned: naresh_bavaskar » Unassigned
kunal_singh’s picture

Status: Needs work » Needs review
Issue tags: +DIACWSep2020

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs review » Needs work

This needs work for the followup asked for in #18.

longwave’s picture

+++ b/core/modules/system/config/install/system.performance.yml
@@ -6,7 +6,7 @@ css:
   exclude_paths: '/\/(?:styles|imagecache)\//'

Out of scope for this issue but surely we don't support /imagecache/ paths any more?

ajv009’s picture

@quietone, I just created a followup issue for tests as said in #18 - https://www.drupal.org/project/drupal/issues/3216273

ajv009’s picture

Yes, @longwave I guess it was removed from D7/8, how about we remove it in this patch itself?
Or create a follow-up issue and patch it?

ajv009’s picture

Status: Needs work » Needs review
mradcliffe’s picture

Issue tags: +Needs tests

@kndr mentioned this issue in #3216273: Add tests for Fast404ExceptionHtmlSubscriber, and that it would be a good opportunity to add a kernel test so I'm adding the Needs tests tag.

In my opinion we need another test (Kernel in such case) that checks if the default fast_404 configuration for the system module is correct. I think it can be done in the very similar way as it was addressed in MigrateSystemConfigurationTest.

It could also be solved in that issue or included in this one, but I'm adding a comment here to get more opinions.

quietone’s picture

Status: Needs review » Needs work
Issue tags: -Novice

Changing to NW for tests per #30 and removing Novice tag.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Believe this could probably move forward now that #3292908: Fast 404s are slower than regular 404s is in D10

smustgrave’s picture

Will definitely need an issue summary update based on what was changed over there.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.