git subrepo clone https://github.com/mailcow/mailcow-dockerized.git mailcow/src/mailcow-dockerized
subrepo: subdir: "mailcow/src/mailcow-dockerized"
merged: "a832becb"
upstream: origin: "https://github.com/mailcow/mailcow-dockerized.git"
branch: "master"
commit: "a832becb"
git-subrepo: version: "0.4.3"
origin: "???"
commit: "???"
Change-Id: If5be2d621a211e164c9b6577adaa7884449f16b5
diff --git a/mailcow/src/mailcow-dockerized/data/web/resource.php b/mailcow/src/mailcow-dockerized/data/web/resource.php
new file mode 100644
index 0000000..96d41c1
--- /dev/null
+++ b/mailcow/src/mailcow-dockerized/data/web/resource.php
@@ -0,0 +1,28 @@
+<?php
+
+$pathinfo = pathinfo($_GET['file']);
+$extension = strtolower($pathinfo['extension']);
+
+$filepath = '/tmp/' . $pathinfo['basename'];
+$content = '';
+
+if (file_exists($filepath)) {
+ $secondsToCache = 31536000;
+ $expires = gmdate('D, d M Y H:i:s', time() + $secondsToCache) . ' GMT';
+
+ if ($extension === 'js') {
+ header('Content-Type: application/javascript');
+ } elseif ($extension === 'css') {
+ header('Content-Type: text/css');
+ } else {
+ //currently just css and js should be supported!
+ exit();
+ }
+
+ header("Expires: $expires");
+ header('Pragma: cache');
+ header('Cache-Control: max-age=' . $secondsToCache);
+ $content = file_get_contents($filepath);
+}
+
+echo $content;