Skip to content

Commit

Permalink
Rewrite /v0 => / in development for es clients
Browse files Browse the repository at this point in the history
  • Loading branch information
rwstauner committed May 24, 2014
1 parent 8f71cd1 commit f1269f1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/MetaCPAN/Server.pm
Expand Up @@ -82,6 +82,14 @@ __PACKAGE__->setup(

my $app = __PACKAGE__->apply_default_middlewares( __PACKAGE__->psgi_app );

# Using an ES client against the API requires an index (/v0).
# In production nginx handles this.
if ( $ENV{PLACK_ENV} && $ENV{PLACK_ENV} eq 'development' ) {
require Plack::Middleware::Rewrite;
$app = Plack::Middleware::Rewrite->wrap( $app,
rules => sub {s{^/?v\d+/}{}} );
}

# Should this be `unless ( $ENV{HARNESS_ACTIVE} ) {` ?
{
my $scoreboard = __PACKAGE__->path_to(qw(var tmp scoreboard));
Expand Down

0 comments on commit f1269f1

Please sign in to comment.