Browse Source

Merge pull request #995 from Alireza2n/master

SOGO & Rspamd interface: adding "expire" header to static files, allowing browser to be able to cache them
André Peters 7 years ago
parent
commit
993c998716
1 changed files with 15 additions and 0 deletions
  1. 15 0
      data/conf/nginx/site.conf

+ 15 - 0
data/conf/nginx/site.conf

@@ -7,6 +7,15 @@ map $http_x_forwarded_proto $client_req_scheme {
      https https;
 }
 
+map $sent_http_content_type $expires {
+        default off;
+        text/html off;
+        text/css 1d;
+        application/javascript 1d;
+        application/json off;
+        image/png       1d;
+}
+
 server {
   include /etc/nginx/mime.types;
   charset utf-8;
@@ -74,6 +83,7 @@ server {
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_redirect off;
+    expires $expires;
   }
 
   location ~* ^/Autodiscover/Autodiscover.xml {
@@ -144,6 +154,7 @@ server {
     proxy_cache_valid 200 1d;
     proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
     #alias /usr/lib/GNUstep/SOGo/WebServerResources/;
+    expires $expires;
     allow all;
   }
 
@@ -154,6 +165,7 @@ server {
     proxy_cache_valid 200 1d;
     proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
     #alias /usr/lib/GNUstep/SOGo/WebServerResources/;
+    expires $expires;
     allow all;
   }
 
@@ -256,6 +268,7 @@ server {
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_redirect off;
+    expires $expires;
   }
 
   location ~* ^/Autodiscover/Autodiscover.xml {
@@ -326,6 +339,7 @@ server {
     proxy_cache_valid 200 1d;
     proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
     #alias /usr/lib/GNUstep/SOGo/WebServerResources/;
+    expires $expires;
     allow all;
   }
 
@@ -336,6 +350,7 @@ server {
     proxy_cache_valid 200 1d;
     proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
     #alias /usr/lib/GNUstep/SOGo/WebServerResources/;
+    expires $expires;
     allow all;
   }