From 9a54729ef6a379a7214843fde5ebb75e371c430c Mon Sep 17 00:00:00 2001
From: Andrew Yates <ayates@ebi.ac.uk>
Date: Tue, 25 Sep 2012 15:40:59 +0000
Subject: [PATCH] / is also not rate limtied (only when it is / alone)

---
 configurations/production/ensrest.psgi | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/configurations/production/ensrest.psgi b/configurations/production/ensrest.psgi
index d2ee4d9d..09b24feb 100644
--- a/configurations/production/ensrest.psgi
+++ b/configurations/production/ensrest.psgi
@@ -9,9 +9,12 @@ use Plack::Builder;
 use Plack::Util;
 use Plack::Middleware::Throttle::Backend::Memcached;
 
-my $app = EnsEMBL::REST->apply_default_middlewares(EnsEMBL::REST->psgi_app);
+my $app = EnsEMBL::REST->psgi_app;
 
 builder {
+
+  #------ Set appropriate headers when we detect REST is being used as a ReverseProxy
+  enable "Plack::Middleware::ReverseProxy";
   
   my $dirname = dirname(__FILE__);
   my $rootdir = File::Spec->rel2abs(File::Spec->catdir($dirname, File::Spec->updir(), File::Spec->updir()));
@@ -33,8 +36,8 @@ builder {
     message => 'You have exceeded your limit which is 11,100 requests per hour (~3 per second)',
     path    => sub {
       my ($path) = @_;
-      return 1 if $path eq '/';
-      return 1 if $path !~ /\/(?:documentation|static)/;
+      return 1 if $path ne '/';
+      return 1 if $path !~ /\/(?:documentation|static|_asset)/;
       return 0;
     }
   );
@@ -55,8 +58,8 @@ builder {
     message => 'You have exceeded the limit of 6 requests per second; please reduce your concurrent connections',
     path    => sub {
       my ($path) = @_;
-      return 1 if $path eq '/';
-      return 1 if $path !~ /\/(?:documentation|static)/;
+      return 1 if $path ne '/';
+      return 1 if $path !~ /\/(?:documentation|static|_asset)/;
       return 0;
     }
   );
@@ -72,9 +75,6 @@ builder {
         check_every_n_requests => 10,
     );
 
-    #------ Make uri_for do the right thing -- COMMENTED OUT SINCE apply_default_middlewares() BRINGS IT IN
-    #enable "Plack::Middleware::ReverseProxy";
-
     #------ Adds a better stack trace
     enable 'StackTrace';
 
-- 
GitLab