-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App::File and Directory to support index.html #93
Comments
More fun with regex. The following seems to serve a static directory (URI) as directory/index.html, where directory is defined as call without "."
|
This allows you to specify a file to return when a request asks for a directory but no file exists at that path. See GH plack#93.
We'd love to solve this by writing a piece of middleware that wraps ::File (or ::Directory) so that we can actually make it work with non file based backend as well, but haven't figured out how to do so effectively. |
https://metacpan.org/release/LLAP/Plack-Middleware-DirIndex-0.01 <- this exists, doesn't try to do anything clever other than add the dir_index if the PATH_INFO ends in / Patches for smarter stuff welcome, but scratches my itch for now. |
DirIndex is working for me, and there are no recent comments --- can this be closed? |
From Larry Marso -
Is it possible to coax any of Plack's static modules to automatically
serve the index.html a directory level, when a browser is called on
that directory?
In other words, how can I get a call to http://site/static/blog
to serve up http://site/static/blog/index.html ???
Standard Plack::App::File (or Directory) and Plack::Middleware::Static
don't seem to do that.
Best I could come up with was the following hack, which only works for
one specified directory. Is there a solution of general applicability?
my $app3 = Plack::App::File->new( file => "/var/www/static/site/blog/index.html")->to_app;
builder {
enable "Plack::Middleware::Static", path => qr{^/blog/.+}, root => '/var/www/static/site/';
mount "/blog" => $app3;
}
}
and so on.
The text was updated successfully, but these errors were encountered: