Merge pull request #995 from Alireza2n/master

SOGO & Rspamd interface: adding "expire" header to static files, allowing browser to be able to cache them
master
André Peters 2018-02-14 07:50:22 +01:00 committed by GitHub
commit 993c998716
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

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