Cache-control headers for all requests

This commit is contained in:
2023-11-04 21:44:00 +01:00
parent 205ff9f2f4
commit d982c5fe48

View File

@@ -6,6 +6,14 @@ http {
include mime.types; include mime.types;
sendfile on; sendfile on;
map $sent_http_content_type $cacheable_types {
"text/html" "max-age=86400"; # 1 day
"application/javascript" "max-age=31536000"; # 1 year
"text/css" "max-age=31536000";
"image/jpeg" "max-age=31536000";
default "max-age=2592000"; # 30 days
}
server { server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
@@ -17,5 +25,9 @@ http {
root /app/; root /app/;
gzip_static on; gzip_static on;
location / {
add_header "Cache-Control" $cacheable_types;
}
} }
} }