Plack::App::Vhost - Simple virtual host implementation on Plack.
use Plack::App::Vhost; Plack::App::Vhost->new( vhosts => [ qr/^foo-mode\.my-app/ => $foo_app, qr/^bar-mode\.my-app/ => $bar_app, ], fallback => sub { my $env = shift; open my $fh, '<', 'path/to/404.html'; return [404, ['Content-Type' => 'text/html', 'Content-Length' => -s $fh], [$fh]]; }, )->to_app;
Plack::App::Vhost is virtual host implementation on Plack.
Creates a new Plack::App::Vhost instance. Arguments can be:
vhosts
Specify regex and PSGI application pairs in order of preference. If HTTP_HOST matches to the regexp, Executes PSGI application of the pair.
HTTP_HOST
fallback
Specify fallback PSGI application. If HTTP_HOST does not match to any regexp, Executes fallback PSGI application.
Creates as a PSGI application.
Plack::App::HostMap
Copyright (C) karupanerura.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
karupanerura <karupa@cpan.org>
To install Plack::App::Vhost, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::App::Vhost
CPAN shell
perl -MCPAN -e shell install Plack::App::Vhost
For more information on module installation, please visit the detailed CPAN module installation guide.