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;
17 # Enable to ensure redirects and Atom feed URLs are generated
18 # properly when running behind a reverse proxy server which
19 # sets the X-Forwarded-Proto request header.
20 # See Plack::Middleware::ReverseProxy documentation for details
21 # enable 'ReverseProxy';
24 sub { $www->call(@_) };
26 Plack::Handler::CGI->new->run($app);