diff options
author | Yorhel <git@yorhel.nl> | 2021-12-04 12:44:09 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2021-12-04 12:44:11 +0100 |
commit | ff131288a94efd47b8d1e92944950a76490230b5 (patch) | |
tree | fd6218e5b95193019217666e28f6b0ebbc29f46c /util | |
parent | 82bdb8ee87de9a2c20dff44071c3899085dde20b (diff) |
Serve contents of www/ even when not in standalone mode
This simplifies web server configuration a bit. There's not many files
in www/ and they're not requested often enough that performance might
become a problem.
Diffstat (limited to 'util')
-rwxr-xr-x | util/vndb.pl | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/util/vndb.pl b/util/vndb.pl index bfaad81b..54155e04 100755 --- a/util/vndb.pl +++ b/util/vndb.pl @@ -31,12 +31,16 @@ tuwf->{elmgen} = $ARGV[0] && $ARGV[0] eq 'elmgen'; TUWF::hook before => sub { - # If we're running standalone, serve www/ and static/ too. - if(tuwf->{_TUWF}{http}) { - if(tuwf->resFile("$ROOT/www", tuwf->reqPath) || tuwf->resFile("$ROOT/static", tuwf->reqPath)) { - tuwf->resHeader('Cache-Control' => 'max-age=31536000'); - tuwf->done; - } + # Serve static files from www/ + if(tuwf->resFile("$ROOT/www", tuwf->reqPath)) { + tuwf->resHeader('Cache-Control' => 'max-age=86400'); + tuwf->done; + } + + # If we're running standalone, serve static/ too. + if(tuwf->{_TUWF}{http} && tuwf->resFile("$ROOT/static", tuwf->reqPath)) { + tuwf->resHeader('Cache-Control' => 'max-age=31536000'); + tuwf->done; } # Use a 'SameSite=Strict' cookie to determine whether this page was loaded from internal or external. |