From 3fccfd75ed7362ee6ea5e3e2f870b8f8d1fbca18 Mon Sep 17 00:00:00 2001 From: jeevi cao <542561541@qq.com> Date: Fri, 11 Apr 2025 01:57:41 +0800 Subject: [PATCH] feat: frontend docker nginx configuration add brower cache accelerated pages access (#7125) * Update py_autofix.yml * feat: frontend docker nginx add brower cache accelerate page access * Revert "Update py_autofix.yml" This reverts commit 7aed45e98602f57c2d6d33532080bad30cf02507. * revert py_autofix.yml * Revert "Update py_autofix.yml" This reverts commit 7aed45e98602f57c2d6d33532080bad30cf02507. * add: remove blank line * fix: update Nginx configuration to prevent caching for index.html --------- Co-authored-by: tianzhipeng Co-authored-by: caojianwei-jk --- docker/frontend/default.conf.template | 8 ++++++++ docker/frontend/nginx.conf | 2 ++ 2 files changed, 10 insertions(+) diff --git a/docker/frontend/default.conf.template b/docker/frontend/default.conf.template index 76864def4..9e8bf9c0d 100644 --- a/docker/frontend/default.conf.template +++ b/docker/frontend/default.conf.template @@ -27,7 +27,15 @@ http { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html =404; + expires 1d; + add_header Cache-Control "public"; } + location = /index.html { + root /usr/share/nginx/html; + add_header Cache-Control "no-cache, no-store, must-revalidate"; + etag on; + } + location /api { proxy_pass ${BACKEND_URL}; } diff --git a/docker/frontend/nginx.conf b/docker/frontend/nginx.conf index b064a5a79..05f90d0c3 100644 --- a/docker/frontend/nginx.conf +++ b/docker/frontend/nginx.conf @@ -13,6 +13,8 @@ server { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html =404; + expires 1d; + add_header Cache-Control "public"; } location /api { proxy_pass __BACKEND_URL__;