2 # Copyright (C) 2014-2020 all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ or later <https://www.gnu.org/licenses/agpl-3.0.txt>
5 # Enables using PublicInbox::WWW as a CGI script
8 for (qw(Plack::Builder Plack::Handler::CGI)) {
9 eval("require $_") or die "E: Plack is required for $0\n";
11 Plack::Builder->import;
12 require PublicInbox::WWW;
13 PublicInbox::WWW->preload if $ENV{MOD_PERL};
15 my $www = PublicInbox::WWW->new;
16 my $have_deflater = eval { require Plack::Middleware::Deflater; 1 };
20 content_type => [ 'text/html', 'text/plain',
21 'application/atom+xml' ];
24 # Enable to ensure redirects and Atom feed URLs are generated
25 # properly when running behind a reverse proxy server which
26 # sets the X-Forwarded-Proto request header.
27 # See Plack::Middleware::ReverseProxy documentation for details
28 # enable 'ReverseProxy';
31 sub { $www->call(@_) };
33 Plack::Handler::CGI->new->run($app);