]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7037 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 19 Aug 2024 14:13:45 +0000 (16:13 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 19 Aug 2024 14:13:45 +0000 (16:13 +0200)
app/Models/FluidbookExternalInstallServer.php
resources/hosting/server/config/httpd.conf

index d488dedcbb3dc2e47ee81478f2af80fe7136ead4..659f76c467142bd4066112dd1dd32d47f94d6aaf 100644 (file)
@@ -100,6 +100,8 @@ class FluidbookExternalInstallServer extends ExternalServer
         if ($this->isHosting()) {
             $redirections = Json::isJson($this->redirections) ? json_decode($this->redirections, true) : $this->redirections;
 
+            $expires = 3600 * 24 * 30;
+
             $content = '<IfModule mod_rewrite.c>
     <IfModule mod_negotiation.c>
         Options -MultiViews -Indexes
@@ -115,7 +117,16 @@ class FluidbookExternalInstallServer extends ExternalServer
                 }
                 $content .= '    RewriteRule ' . $redirection['from'] . ' /' . ltrim($redirection['to'], '/') . " [R=308,L]\n";
             }
-            $content .= '</IfModule>' . "\n";
+            $content .= '</IfModule>
+<IfModule mod_headers.c>
+    Header set Cache-Control "max-age=' . $expires . ', public"
+</IfModule>
+<IfModule mod_expires.c>
+    ExpiresActive On
+    ExpiresDefault "access plus ' . $expires . ' seconds"
+</IfModule>';
+
+
             $tmp = Files::tempnam();
             file_put_contents($tmp, $content);
             $this->getTransferDriver()->copyFile($tmp, '.htaccess');
index fade4cecb0c9ddf13085a22f49e1b0a6d1b1f352..fef23ecff8e53d0f9d6d52e40e15db929e94b9f1 100644 (file)
@@ -1,4 +1,6 @@
 LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
+LoadModule expires_module /usr/lib/apache2/modules/mod_expires.so
+LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
 
 <Directory /var/www/html>
         Options Indexes FollowSymLinks