Skip to content

Instantly share code, notes, and snippets.

@leedo
Created September 26, 2011 22:17
Show Gist options
  • Select an option

  • Save leedo/1243567 to your computer and use it in GitHub Desktop.

Select an option

Save leedo/1243567 to your computer and use it in GitHub Desktop.
psgi blacklist middleware
my $ref_blacklist = [
qr{antronio},
];
my $refcheck = sub {
my $app = shift;
sub {
my $env = shift;
for (@$ref_blacklist) {
return [401, [], ['forbidden']] if $env->{HTTP_REFERER} =~ $_;
}
return $app->($env);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment