ProxyRequests Off
ProxyPreserveHost On
ProxyPass /rules http://localhost:3000/ keepalive=On
ProxyPassReverse /rules http://localhost:3000/
RequestHeader set X-Forwarded-HTTPS "0"
####
app->hook(before_dispatch => sub {
my ( $c ) = @_;
my $url = $c->req->url;
my $base = $url->base;#
push @{ $base->path }, 'rules';
$base->path->trailing_slash(1);
$url->path->leading_slash(0);
});
get '/' => sub {
my $self = shift;
my $host = $self->tx->remote_address;
my $content = "Host: $host";
$self->stash(content=>$content);
$self->render('index');
};
get '/user' => sub {
my $self = shift;
my $host = $self->tx->remote_address;
my $content = "Host: $host";
$self->stash(content=>$content);
$self->render('index');
};
app->start;
__DATA__
@@ index.html.ep
% layout 'default';
<%== $content %>
@@ layouts/default.html.ep
Test
%= button_to Home => '/'
%= button_to User => '/user'
%= link_to Home => '/'
%= link_to User => 'user'
%= content
##
##
Test
Home
User
Host: 127.0.0.1
##
##
Home
User