]> Sergey Matveev's repositories - public-inbox.git/blob - script/public-inbox.cgi
watch: log signal activities to STDERR
[public-inbox.git] / script / public-inbox.cgi
1 #!/usr/bin/perl -w
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>
4 #
5 # Enables using PublicInbox::WWW as a CGI script
6 use strict;
7 BEGIN {
8         for (qw(Plack::Builder Plack::Handler::CGI)) {
9                 eval("require $_") or die "E: Plack is required for $0\n";
10         }
11         Plack::Builder->import;
12         require PublicInbox::WWW;
13         PublicInbox::WWW->preload if $ENV{MOD_PERL};
14 }
15 my $www = PublicInbox::WWW->new;
16 my $app = builder {
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';
22
23         enable 'Head';
24         sub { $www->call(@_) };
25 };
26 Plack::Handler::CGI->new->run($app);