How to make an IP Ban for my game

Project: https://kg-agario.glitch.me
So I’m very new to coding but i have a clone of an agario glitch project and someone has been causing trouble on the site. I need a way to ip ban them. I already have their ip I just need to make it so they’re unable to access the live site. Thanks!

1 Like

Make a file(s) to detect the player’s IP address

1 Like

Because of the way Glitch traffic is routed from the open web you don’t have a way to outright kill their request. The request will always get to your project container and consume a request (against your 4000/hr quota).

Once in your project you can pull the IP address from the headers and implement some logic to redirect “banned” addresses to some other content/error pages.

A more traditional IP ban would occur before the request reached the web server in your Glitch container. On Glitch the only way I’m aware of accomplishing that is to using a custom domain and routing that through a provider like Cloudflare. Of course that isn’t perfect, Cloudflare could be completely bypassed by using your *.glitch.me URL.

2 Likes

Do note that on the Cloudflare free plan you can create 5 rules (5 banned IPs)