long browser caching for everything except text/html (fixes #16)

This commit is contained in:
Felix 2020-02-15 17:54:08 +01:00
parent 6d86424107
commit 1f6fc82de1

View file

@ -14,6 +14,13 @@ http {
access_log /var/log/nginx/access.log main; access_log /var/log/nginx/access.log main;
sendfile on; sendfile on;
keepalive_timeout 65; keepalive_timeout 65;
# Expires map
map $sent_http_content_type $expires {
default 30d;
text/html 2h;
}
server { server {
listen 80; listen 80;
server_name localhost; server_name localhost;
@ -21,13 +28,11 @@ http {
# Hide nginx version # Hide nginx version
server_tokens off; server_tokens off;
# TODO: maybe setup cache as well
location / { location / {
root /app; root /app;
index index.html; index index.html;
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
expires 1d; expires $expires;
add_header Pragma public; add_header Pragma public;
add_header Cache-Control "public"; add_header Cache-Control "public";
} }