Adding reverse proxy support.
This commit is contained in:
parent
ae16dd4b6b
commit
20da362510
@ -6,27 +6,32 @@ use Mojo::Base 'Mojolicious', -signatures;
|
|||||||
|
|
||||||
# This method will run once at server start
|
# This method will run once at server start
|
||||||
sub startup ($self) {
|
sub startup ($self) {
|
||||||
my $metrics = BurguillosInfo::Controller::Metrics->new;
|
my $metrics = BurguillosInfo::Controller::Metrics->new;
|
||||||
$self->hook(around_dispatch => sub {
|
$self->hook(
|
||||||
my $next = shift;
|
around_dispatch => sub {
|
||||||
my $c = shift;
|
my $next = shift;
|
||||||
$metrics->request($c);
|
my $c = shift;
|
||||||
if (defined $next) {
|
$metrics->request($c);
|
||||||
$next->();
|
if ( defined $next ) {
|
||||||
}
|
$next->();
|
||||||
});
|
}
|
||||||
my $config = $self->plugin('JSONConfig');
|
}
|
||||||
$self->config(hypnotoad => {listen => ['http://localhost:3000']});
|
);
|
||||||
# Router
|
my $config = $self->plugin('JSONConfig');
|
||||||
my $r = $self->routes;
|
$self->config(
|
||||||
|
hypnotoad => { proxy => 1, listen => ['http://localhost:3000'] } );
|
||||||
# Normal route to controller
|
|
||||||
$r->get('/')->to('Page#index');
|
# Router
|
||||||
# $r->get('/:post')->to('Page#post');
|
my $r = $self->routes;
|
||||||
$r->get('/<:category>.rss')->to('Page#category_rss');
|
|
||||||
$r->get('/:category')->to('Page#category');
|
# Normal route to controller
|
||||||
$r->get('/posts/<:slug>-preview.png')->to('Page#get_post_preview');
|
$r->get('/')->to('Page#index');
|
||||||
$r->get('/posts/:slug')->to('Page#post');
|
|
||||||
|
# $r->get('/:post')->to('Page#post');
|
||||||
|
$r->get('/<:category>.rss')->to('Page#category_rss');
|
||||||
|
$r->get('/:category')->to('Page#category');
|
||||||
|
$r->get('/posts/<:slug>-preview.png')->to('Page#get_post_preview');
|
||||||
|
$r->get('/posts/:slug')->to('Page#post');
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
Loading…
Reference in New Issue
Block a user