From 6e8253de39b93a771662d6577a95e0c62bf6c247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Garn=C3=A6s?= Date: Fri, 20 Dec 2024 09:36:51 +0100 Subject: [PATCH] Revert "Merge pull request #442 from danskernesdigitalebibliotek/no-varnish-for-static-files" This reverts commit 3e0c1f8719b2214a81bf7a30264c7f119dc14306, reversing changes made to 5b2fa5cbf4e1a90bbfb42cdec6f13eae54d193a0. Disabling Varnish caching for static files did not impact Varnish memory usage significantly. However it notably increased file system usage and thus brought up cost. Consequently we have decided to revert the change. --- ...r_append_disable_varnish_static_files.conf | 45 ------------------- .../standard/lagoon/nginx.dockerfile | 3 -- 2 files changed, 48 deletions(-) delete mode 100644 infrastructure/dpladm/env-repo-template/standard/lagoon/conf/nginx/server_append_disable_varnish_static_files.conf diff --git a/infrastructure/dpladm/env-repo-template/standard/lagoon/conf/nginx/server_append_disable_varnish_static_files.conf b/infrastructure/dpladm/env-repo-template/standard/lagoon/conf/nginx/server_append_disable_varnish_static_files.conf deleted file mode 100644 index ab14a63e..00000000 --- a/infrastructure/dpladm/env-repo-template/standard/lagoon/conf/nginx/server_append_disable_varnish_static_files.conf +++ /dev/null @@ -1,45 +0,0 @@ -# Disable Varnish cache for all static files. Nginx will serve them just as quick. -# -# This is based on support for Surrogate-control supported by the Lagoon -# Varnish for Drupal image: -# https://github.com/uselagoon/lagoon-images/blob/main/images/varnish-drupal/drupal.vcl#L356 -# -# Drupal generated and user uploaded files -location ^~ /sites/default/files/ { - add_header Surrogate-Control "no-store" always; - try_files $uri @drupal-files; -} -# External libraries managed by Drupal Core may contain static files. -location ^~ /core/assets/vendor/ { - add_header Surrogate-control "no-store" always; -} -# External libraries may contain static files. -location ^~ /libraries/ { - add_header Surrogate-control "no-store" always; -} -# Static files from the theme which will not be bundled by Drupal e.g. -# fonts and icons. -location ^~ /themes/custom/novel/assets/dpl-design-system/ { - add_header Surrogate-control "no-store" always; -} - -# Duplicate of upstrean @drupal location provided by the Lagoon Nginx image for -# for Drupal. -# https://github.com/uselagoon/lagoon-images/blob/main/images/nginx-drupal/drupal.conf#L72 -# -# This is needed to add an additional response header to files generated by -# Drupal at runtime. Once the file is generated then the existing location will -# take precedence but if does not then try_files will issue an internal -# redirect which requires the headers to be set again. -location @drupal-files { - include /etc/nginx/conf.d/drupal/location_drupal_prepend*.conf; - - include /etc/nginx/fastcgi.conf; - fastcgi_param SCRIPT_NAME /index.php; - fastcgi_param SCRIPT_FILENAME $realpath_root/index.php; - fastcgi_pass ${NGINX_FASTCGI_PASS:-php}:9000; - - add_header Surrogate-control "no-store" always; - - include /etc/nginx/conf.d/drupal/location_drupal_append*.conf; -} \ No newline at end of file diff --git a/infrastructure/dpladm/env-repo-template/standard/lagoon/nginx.dockerfile b/infrastructure/dpladm/env-repo-template/standard/lagoon/nginx.dockerfile index 974f47dd..11f41d6e 100644 --- a/infrastructure/dpladm/env-repo-template/standard/lagoon/nginx.dockerfile +++ b/infrastructure/dpladm/env-repo-template/standard/lagoon/nginx.dockerfile @@ -15,9 +15,6 @@ RUN fix-permissions /etc/nginx/conf.d/drupal/location_prepend_drupal_authorize.c COPY lagoon/conf/nginx/location_prepend_drupal_update.conf /etc/nginx/conf.d/drupal/location_prepend_drupal_update.conf RUN fix-permissions /etc/nginx/conf.d/drupal/location_prepend_drupal_update.conf -COPY lagoon/conf/nginx/server_append_disable_varnish_static_files.conf /etc/nginx/conf.d/drupal/server_append_disable_varnish_static_files.conf -RUN fix-permissions /etc/nginx/conf.d/drupal/server_append_disable_varnish_static_files.conf - COPY lagoon/conf/nginx/server_append_drupal_authorize.conf /etc/nginx/conf.d/drupal/server_append_drupal_authorize.conf RUN fix-permissions /etc/nginx/conf.d/drupal/server_append_drupal_authorize.conf