Skip to content
Snippets Groups Projects
Commit 9a54729e authored by Andy Yates's avatar Andy Yates
Browse files

/ is also not rate limtied (only when it is / alone)

parent e2204ee4
No related branches found
No related tags found
No related merge requests found
......@@ -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';
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment