From bf3c97f9812d0709c242baf5c3c0720f140158e4 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Fri, 7 Aug 2020 10:20:28 +0200 Subject: [PATCH] index.pl: Serve static files when in direct HTTP server mode Makes it easier to setup a quick development server. --- www/index.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/www/index.pl b/www/index.pl index c02db7d..7be242e 100755 --- a/www/index.pl +++ b/www/index.pl @@ -44,6 +44,16 @@ TUWF::set( ); +TUWF::hook before => sub { + if(tuwf->{_TUWF}{http}) { + if(tuwf->resFile("$ROOT/www", tuwf->reqPath)) { + tuwf->resHeader('Cache-Control' => 'max-age=31536000'); + tuwf->done; + } + } +}; + + TUWF::register( qr// => \&home, qr{info/about} => \&about,