Merge pull request #2131 from mempool/ops/reduce-nginx-cache-time-for-homepage

Reduce nginx cache time for production homepage
This commit is contained in:
wiz 2022-07-18 17:56:55 -05:00 committed by GitHub
commit 88febf6262
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,13 +46,13 @@ add_header Vary Cookie;
# https://stackoverflow.com/questions/5238377/nginx-location-priority
# for exact / requests, redirect based on $lang
# cache redirect for 10 minutes
# cache redirect for 5 minutes
location = / {
if ($lang != '') {
return 302 $scheme://$host/$lang/;
}
try_files /en-US/index.html =404;
expires 10m;
expires 5m;
}
# used to rewrite resources from /<lang>/ to /en-US/
@ -66,14 +66,14 @@ location ~ ^/([a-z][a-z])/(.+\..+\.(js|css)) {
try_files $uri =404;
expires 1y;
}
# cache everything else for 10 minutes
# cache everything else for 5 minutes
location ~ ^/([a-z][a-z])$ {
try_files $uri /$1/index.html /en-US/index.html =404;
expires 10m;
expires 5m;
}
location ~ ^/([a-z][a-z])/ {
try_files $uri /$1/index.html /en-US/index.html =404;
expires 10m;
expires 5m;
}
# cache /resources/** for 1 week since they don't change often
@ -87,8 +87,8 @@ location ~* ^/.+\..+\.(js|css) {
expires 1y;
}
# catch-all for all URLs i.e. /address/foo /tx/foo /block/000
# cache 10 minutes since they change frequently
# cache 5 minutes since they change frequently
location / {
try_files /$lang/$uri $uri /en-US/$uri /en-US/index.html =404;
expires 10m;
expires 5m;
}