Thank you for the really fast answer!
This works:
use Plack::Builder;
use Plack::MIME;
for my $expr (
".c", ".cpp", ".css", ".csv", ".dat", ".dpl"
, ".gp", ".h", ".hpp", ".html", ".ini"
, ".java", ".js", "makefile", "Makefile", ".m", ".mac"
, ".pl", ".pm", ".pod", ".py", "README", ".sch", ".sh", ".txt") {
Plack::MIME->add_type($expr => 'text/plain');
}
builder {
enable 'Plack::Middleware::Static',
path => qr{^/html/downloads/},
root => '.';
enable 'Plack::Middleware::Static',
path => qr{^/html/(?!downloads).*\.(css|gif|jpg|js|pdf|png)$},
root => '.',
content_type => sub { Plack::MIME->mime_type($_[0]); };
mount "/" => $app1;
mount "/imggenerator.pl" => $app2;
};
But I'm far from really understanding it and there still is one issue:
.html in downloads are still treated as html files, not as plain text.