From 3d9bcdfc96c50b0586cc87134b6fb33db258463f Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Wed, 24 Jul 2024 13:19:44 +0200 Subject: [PATCH 1/2] Cache: Set `cache-control` headers for revalidation --- Dockerfile | 2 +- README.md | 2 +- etc/000-default.conf | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6c97fbf..d96f1b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM php:8.1-apache -RUN a2enmod proxy && a2enmod rewrite +RUN a2enmod proxy && a2enmod rewrite && a2enmod headers EXPOSE 80 \ No newline at end of file diff --git a/README.md b/README.md index 11c9504..bbfd813 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ System requirements: * PHP 7+ To run the site: -* `a2enmod proxy` and `a2enmod rewrite` to enable proxy pass and rewrite rules +* `a2enmod proxy`, `a2enmod rewrite` and `a2enmod headers` to enable proxy pass, rewrite rules and setting headers * Add the `000-default.conf` to the `sites-available` ### Setup with Docker diff --git a/etc/000-default.conf b/etc/000-default.conf index 85ecee0..8c0297d 100644 --- a/etc/000-default.conf +++ b/etc/000-default.conf @@ -26,6 +26,13 @@ SetHandler application/x-httpd-php + + # Make sure that CDN77 revalidates every 60 sec to prevent cache drift between builds and their shasum counterpart + + Header set Cache-Control "public, max-age=60, must-revalidate" + + + ProxyPass /admin/ws ws://localhost:8010/ws ProxyPassReverse /admin/ws ws://localhost:8010/ws ProxyPass /admin/ http://localhost:8010/ -- 2.30.2 From 02896cb07141a5e97392d2f072e6191474d09615 Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Wed, 24 Jul 2024 13:23:35 +0200 Subject: [PATCH 2/2] Docs: Add `--build` flag to rebuild when changes --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bbfd813..2bf6d9a 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,8 @@ To run the website using Docker, follow these steps: Use the provided `Dockerfile` and `docker-compose.yml` to build and start the containers. Execute the following command: ```sh -docker compose up +docker compose up --build +# --build makes sure to rebuild the image in case there were changes to the Dockerfile ``` Once the containers are up and running, you can access the website on port `8080`: -- 2.30.2