Skip to content

Commit

Permalink
Block more crawlers
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Sep 25, 2023
1 parent b82d5e4 commit de395fc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Controller/PackageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1661,9 +1661,10 @@ private function blockAbusers(Request $req): ?JsonResponse
'14.116.239.33', '14.116.239.34', '14.116.239.35', '14.116.239.36', '14.116.239.37',
'14.22.11.161', '14.22.11.162', '14.22.11.163', '14.22.11.164', '14.22.11.165',
'216.251.130.74',
'212.107.30.81', '35.89.149.248',
];
if ('json' === $req->getRequestFormat() && in_array($req->getClientIp(), $abusers, true)) {
return new JsonResponse("Please use a proper user-agent with contact information or get in touch before abusing the API", 429);
if (in_array($req->getClientIp(), $abusers, true)) {
return new JsonResponse("Please use a proper user-agent with contact information or get in touch before abusing the API", 429, ['Retry-After' => 31536000]);
}

return null;
Expand Down

0 comments on commit de395fc

Please sign in to comment.