diff --git a/CHANGELOG.md b/CHANGELOG.md index 9295a57..3f92000 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ Changelog", this file is a reverse-chronological list of merged pull requests. ## Open PR's +- [PR-168](https://github.com/itk-dev/devops_itkdev-docker/pull/168) - 2026-11-29 - + Send only valid Drupal aggregate names to PHP. - [PR-135](https://github.com/itk-dev/devops_itkdev-docker/pull/135) - 2026-01-29 - Add Podman support with dynamic machine detection - [PR-126](https://github.com/itk-dev/devops_itkdev-docker/pull/126) - 2026-01-05 - diff --git a/templates/drupal/.docker/templates/default.conf.template b/templates/drupal/.docker/templates/default.conf.template index 451bd59..25c3256 100644 --- a/templates/drupal/.docker/templates/default.conf.template +++ b/templates/drupal/.docker/templates/default.conf.template @@ -74,6 +74,19 @@ server { return 404; } + # Drupal builds a missing CSS or JS aggregate on each request. Send only + # file names with a valid hash (43 characters) to Drupal. Return 404 for + # other names, for example "css_x.css" in a cache-busting flood. + # Keep these rules after the deny rules above. Nginx uses the first regex + # location that matches. + location ~ "^/sites/[^/]+/files/(css/css_[A-Za-z0-9_-]{43}\.css|js/js_[A-Za-z0-9_-]{43}\.js)$" { + try_files $uri /index.php?$query_string; + } + + location ~* /sites/[^/]+/files/(css|js)/ { + try_files $uri =404; + } + # Block web access to Drupal's maintenance scripts (update, install, cache # rebuild, and authorize). Use drush and composer for these tasks instead. location ^~ /update.php {