Commit | Line | Data |
b769c101 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use [% name %]; |
5 | use Plack::Middleware::Conditional; |
6 | use Plack::Middleware::ReverseProxy; |
7 | |
a0e1d774 |
8 | my $app = [% name %]->psgi_app; |
b769c101 |
9 | |
10 | $app = Plack::Middleware::Conditional->wrap( |
11 | $app, |
12 | builder => sub { Plack::Middleware::ReverseProxy->wrap($_[0]) }, |
13 | condition => sub { |
14 | my ($env) = @_; |
15 | return if [% name %]->config->{ignore_frontend_proxy}; |
16 | return $env->{REMOTE_ADDR} eq '127.0.0.1' |
17 | || [% name %]->config->{using_frontend_proxy}; |
18 | }, |
19 | ); |
20 | |
21 | $app |