Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cutups's avatar

What's the best way to block IPs from accessing my Laravel site?

I've noticed that there's a large amount of "junk" traffic trying to access my site - likely bots or hackers trying to repeatedly log in or sign up. I do employ recaptcha, so they don't typically successfully sign up and are unable to hit most routes, but I can see logs of lots of attempts. I'd like to implement something that will block their IP for even hitting a login page.

Any suggestions that I can easily implement in Laravel?

0 likes
2 replies
NoLAstNamE's avatar

I think using Cloudflare is the best way, even if you blocked those bots, and malicious IPs on your Laravel app they still hit your server origin and will also count as traffic.

Please or to participate in this conversation.