From daec9aec989948c1e549f43067ee59fbfcb9ee94 Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 3 Apr 2024 23:30:03 +0800 Subject: [PATCH] fix: nginx static file caching --- packages/core/cli/nocobase.conf.tpl | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/packages/core/cli/nocobase.conf.tpl b/packages/core/cli/nocobase.conf.tpl index b1a7dcdfd6a..d6a7cb35b30 100644 --- a/packages/core/cli/nocobase.conf.tpl +++ b/packages/core/cli/nocobase.conf.tpl @@ -23,19 +23,6 @@ server { gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; - # 不缓存 HTML 文件 - # location ~ \.html$ { - # if_modified_since off; - # expires off; - # etag off; - # } - - # # 缓存 JavaScript 和 CSS 文件 - # location ~* \.(js|css)$ { - # expires 365d; - # add_header Cache-Control "public"; - # } - location {{publicPath}}storage/uploads/ { alias {{cwd}}/storage/uploads/; add_header Cache-Control "public"; @@ -51,6 +38,10 @@ server { if_modified_since off; expires off; etag off; + location ~* \.(js|css)$ { + expires 365d; + add_header Cache-Control "public"; + } } location ^~ {{publicPath}}api/ {