Problem/Motivation

I encountered an odd issue where on my production site (not my local site) a certain page would result in the aggregated CSS/JS files failing to load with a 418 response (yes, the teapot one).

teapot

Steps to reproduce

As explained I could only reproduce this on my production site, and not my local machine so I wouldn't know how reproducible this could be, but...

The problem page is the revision diff page, provided by the diff module

  1. Set Adminimal to the main admin theme in /admin/appearance
  2. Enable JS/CSS aggregation in /admin/config/development/performance
  3. Install Diff module
  4. Configure the revision diff page to be Visual Inline using the Admin theme /admin/config/content/diff/general
  5. Clear cache
  6. Go to a revision diff page for a node with multiple revisions
  7. The resulting page (at least for me) has no theme and the aforementioned 418 responses occur on the aggregated files.
  8. Change the admin theme to something besides Adminimal in /admin/appearance
  9. Clear cache
  10. Go back to same node revision diff page
  11. Notice that the page works as expected
  12. Change the admin theme back to Adminimal in /admin/appearance
  13. Clear cache
  14. Go back to same node revision diff page
  15. The same 418 response error occurs on the aggregated files

I haven't had this issue on any other pages with the Adminimal theme.

The reason I figure this is an Adminimal issue (and not Diff) is it only occurs with the Adminimal theme on that certain page.

While I could never figure out why this was occurring, what I did notice is when this failure occurs, the aggregated files never get created, yet they're being referenced to in the resulting page, deleting the js/css folders in /sites/default/files would get re-generated on all other pages, but would not get regenerated for this problem page when using Adminimal.

Proposed resolution

For reasons beyond my understanding I was able to fix this by modifying adminimal_theme.libraries.yml to add adminimal_theme/global-styling dependencies to the other two libraries.

I figure this change shouldn't break anything regardless and is general good practice for library entries as the google-fonts and custom-styling libraries are kind of useless loaded without the main theme's library.

CommentFileSizeAuthor
#2 aggregation-issue-3418990-2.patch472 bytesmdolnik
teapot.png38.96 KBmdolnik

Comments

mdolnik created an issue. See original summary.

mdolnik’s picture

Status: Active » Needs review
StatusFileSize
new472 bytes
mdolnik’s picture

It turns out that the 418 error was caused by dream host's firewall for "malicious HTTP requests"
https://help.dreamhost.com/hc/en-us/articles/215947927-Enabling-the-Web-Application-Firewall

Regardless for some reason the patch to add the theme dependency still resolves this issue.