fix: cache with index.html (#1541)

* fix: cache with index.html

* fix: docker build
This commit is contained in:
ChengLei Shao 2023-03-06 12:00:12 +08:00 committed by GitHub
parent cd7338d1d8
commit 51e6aaec6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -11,6 +11,7 @@ fi
if [ ! -f "/app/nocobase/package.json" ]; then if [ ! -f "/app/nocobase/package.json" ]; then
echo 'copying...' echo 'copying...'
tar -zxf /app/nocobase.tar.gz --absolute-names -C /app/nocobase tar -zxf /app/nocobase.tar.gz --absolute-names -C /app/nocobase
touch /app/nocobase/packages/app/client/dist/index.html
fi fi
cd /app/nocobase && yarn start --quickstart cd /app/nocobase && yarn start --quickstart

View File

@ -10,12 +10,14 @@ server {
# 不缓存 HTML 文件 # 不缓存 HTML 文件
location ~ \.html$ { location ~ \.html$ {
expires -1; if_modified_since off;
expires off;
etag off;
} }
# 缓存 JavaScript 和 CSS 文件 # 缓存 JavaScript 和 CSS 文件
location ~* \.(js|css)$ { location ~* \.(js|css)$ {
expires 1d; expires 365d;
add_header Cache-Control "public"; add_header Cache-Control "public";
} }