From 1f6fc82de1a47f053a820c631693f0690d31a0f8 Mon Sep 17 00:00:00 2001 From: Felix Date: Sat, 15 Feb 2020 17:54:08 +0100 Subject: [PATCH] long browser caching for everything except text/html (fixes #16) --- docker/nginx.conf | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docker/nginx.conf b/docker/nginx.conf index 9103f87..c59dcfd 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -14,6 +14,13 @@ http { access_log /var/log/nginx/access.log main; sendfile on; keepalive_timeout 65; + + # Expires map + map $sent_http_content_type $expires { + default 30d; + text/html 2h; + } + server { listen 80; server_name localhost; @@ -21,13 +28,11 @@ http { # Hide nginx version server_tokens off; - # TODO: maybe setup cache as well - location / { root /app; index index.html; try_files $uri $uri/ /index.html; - expires 1d; + expires $expires; add_header Pragma public; add_header Cache-Control "public"; }