only caching GET requests for static files

closes #1
This commit is contained in:
Rudis Muiznieks 2022-07-19 09:55:43 -05:00
parent 8f04f74800
commit 16cd4d52c5
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
1 changed files with 5 additions and 1 deletions

View File

@ -212,7 +212,11 @@ my $enable_experimental_features = $ENV{'ENABLE_EXPERIMENTAL_FEATURES' } || 0;
if (!serve_static($server, $cgi, $webroot)) {
$cached = 0;
}
$_staticcache->set($path, $cached);
# only save to cache on GET requests
# https://code.sitosis.com/rudism/dotplan-online/issues/1
if ($cgi->request_method() eq 'GET') {
$_staticcache->set($path, $cached);
}
}
print $cached if $cached;
return $cached;