From 79fdadc7f3f173d92d76be0916edae56c8448857 Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 23 Jul 2022 23:54:13 +0800 Subject: [PATCH] Update site_api.py --- class/core/site_api.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/class/core/site_api.py b/class/core/site_api.py index 7e8f6ae10..238bc5b53 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -1548,15 +1548,6 @@ class site_api: tpl = """ # PROXY-START/ -location ~* \.(gif|png|jpg|css|js|woff|woff2)$ -{ - proxy_pass {to}; - proxy_set_header Host {host}; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header REMOTE-HOST $remote_addr; - expires 12h; -} location ~* ^{from}(.*)$ { proxy_pass {to}; proxy_set_header Host {host}; @@ -1567,6 +1558,17 @@ location ~* ^{from}(.*)$ { add_header X-Cache $upstream_cache_status; proxy_ignore_headers Set-Cookie Cache-Control expires; add_header Cache-Control no-cache; + + set $static_files_app 0; + if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" ) + { + set $static_files_app 1; + expires 12h; + } + if ( $static_files_app = 0 ) + { + add_header Cache-Control no-cache; + } } # PROXY-END/ """