]> Sergey Matveev's repositories - public-inbox.git/blobdiff - script/public-inbox-httpd
httpd: allow running if ReverseProxy is missing
[public-inbox.git] / script / public-inbox-httpd
index 6109af01a62cdad79fdd11a3bdeea9652033f94d..19315bb43972297a71ff4be68df8811763110e6e 100755 (executable)
@@ -24,18 +24,24 @@ my $refresh = sub {
                PublicInbox::WWW->preload;
                my $www = PublicInbox::WWW->new;
                $app = eval {
-                       my $deflate_types = eval {
-                               require Plack::Middleware::Deflater;
-                               [ 'text/html', 'text/plain',
-                                       'application/atom+xml' ]
-                       };
                        builder {
                                enable 'Chunked';
-                               if ($deflate_types) {
+                               eval {
                                        enable 'Deflater',
-                                               content_type => $deflate_types
-                               }
-                               enable 'ReverseProxy';
+                                               content_type => [ qw(
+                                                       text/html
+                                                       text/plain
+                                                       application/atom+xml
+                                                       )]
+                               };
+                               $@ and warn
+"Plack::Middleware::Deflater missing, bandwidth will be wasted\n";
+
+                               eval { enable 'ReverseProxy' };
+                               $@ and warn
+"Plack::Middleware::ReverseProxy missing,\n",
+"URL generation for redirects may be wrong if behind a reverse proxy\n";
+
                                enable 'Head';
                                sub { $www->call(@_) };
                        };