Skip to content

Commit

Permalink
add fix for drupal 10 imagecache
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermeindl committed Jul 31, 2024
1 parent a87ffac commit 5de7501
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions roles/drupal/templates/etc/nginx/sites-available/drupal.j2
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ server {
{% endfor %}
{% endif %}

# Drupal 7 generated image handling, i.e., imagecache in core. See:
# Drupal 7 or higher generated image handling, i.e., imagecache in core. See:
# https://drupal.org/node/371374.
location ~ ^/sites/default/files/styles/ {
location ~* /files/(css|js|styles)/ {
{% if drupal_with_hotlink_protection %}
# Image hotlinking protection. If you want hotlinking
# protection for your images uncomment the following line.
include hotlinking_protection.conf;
{% endif %}
expires 1y;
try_files $uri @drupal;
}

Expand All @@ -78,6 +79,23 @@ server {
open_file_cache_errors off;
}

location ~* /sites/.+/files/optimized/(css|js)/ {
expires max;
add_header ETag '';
add_header Last-Modified 'Wed, 20 Jan 1988 04:20:42 GMT';
add_header Accept-Ranges '';
location ~* /sites/.*/files/optimized/css/.+\.css$ {
access_log off;
add_header Cache-Control "public, max-age=31536000, no-transform, immutable";
try_files $uri @drupal;
}
location ~* /sites/.*/files/optimized/js/.+\.js$ {
access_log off;
add_header Cache-Control "public, max-age=31536000, no-transform, immutable";
try_files $uri @drupal;
}
}

# PDFs and powerpoint files handling.
location ~* ^.+\.(?:pdf|pptx?)$ {
expires 30d;
Expand Down

0 comments on commit 5de7501

Please sign in to comment.