Geo-Restrict: Geographic Filtering and Bedrock/Geyser Proxy Detection on Production Minecraft Networks

Category: Tutorial Published: 2026-09-09 Author: DemonZ Development

Implementing strict geographic access rules, Autonomous System Number (ASN) filtering, and bedrock proxy resolution on modern Minecraft networks using Geo-Restrict and edge-cached Cloudflare Workers.


Every public Minecraft server that grows beyond a handful of friends eventually attracts malicious network traffic:

  • Bot Floods from Bulletproof Hosting: Script kiddies renting $3/month VPS instances on bulletproof hosting providers to launch mass-join bots that flood chat and spam auth plugins.
  • Regional Community Policies: Localized language servers (e.g., German, Spanish, or Brazilian SMPs) that only serve players within specific geographic regions and wish to block high-latency traffic from continents away.
  • Evading IP Bans via Commercial VPNs: Banned cheaters cycling through commercial NordVPN or ExpressVPN exit nodes to rejoin within seconds.

Historically, server administrators attempted to counter this with heavy Java plugins that downloaded 150MB GeoIP .mmdb files directly into the server's heap memory. These plugins frequently stalled startup times by 40 seconds, leaked memory, or queried unauthenticated web APIs that immediately rate-limited your server after 50 player joins.

Worse, when deployed in modern hybrid Java & Bedrock environments behind Velocity or BungeeCord proxies, naive plugins fail catastrophically: they inspect the proxy's loopback interface (127.0.0.1), misidentify all players as local connections, or accidentally ban the entire proxy.

With GeoRestrict v2.0, we built an enterprise-grade network security filter that resolves geographic location, Autonomous System Numbers (ASNs), and proxy signals without burdening your Minecraft server runtime.


1. The Proxy & Geyser Header Trap: Resolving the Real Client IP

On a modern production network, player packets do not travel directly from a client to your Paper backend. They pass through multiple hops:

Java Player (e.g. 198.51.100.45) ──────┐
                                       ├──► Velocity Proxy (10.0.0.1) ──► Paper Backend
Bedrock Player via Geyser (203.0.113.12)─┘      (HAProxy Protocol v2)       (10.0.0.5)

If you run a standard geolocation check on the backend without proper protocol forwarding:

// NAIVE APPROACH: DO NOT DO THIS
InetAddress addr = player.getAddress().getAddress();
// Returns 10.0.0.1 or 127.0.0.1!

The IP returned is the proxy's internal private IP. If your geolocation rule blocks unknown private ranges or flags unusual traffic, every single player on your network is kicked simultaneously.

How GeoRestrict Solves This

GeoRestrict is built to run at both tiers:

  1. On Velocity / BungeeCord: GeoRestrict executes during the PreLoginEvent or LoginEvent directly on the proxy. It catches and rejects unauthorized connections before a backend server connection is even negotiated, saving valuable backend CPU cycles.
  2. On Paper / Purpur / Folia: If deployed directly on a backend server behind a proxy, GeoRestrict integrates with Velocity Modern Forwarding, BungeeCord IP-Forwarding, and HAProxy PROXY Protocol v2 headers. It unwraps the true originating client IP address, ensuring that Bedrock players connecting via Geyser/Floodgate are correctly identified by their real mobile or residential IP.

2. Multi-Tier Resolution Architecture: Edge Caching & Fallback Resilience

Making a synchronous external HTTP call for every connecting player during a bot attack is a guaranteed recipe for taking down your own login pipeline.

GeoRestrict uses a high-throughput, multi-tiered resolution pipeline:

Incoming Minecraft Handshake
       │
       ▼
┌─────────────────────────────────────────────────────────────┐
│ Tier 1: Local In-Memory Plugin Cache (Sub-microsecond)      │
│ - High-performance bounded concurrent LRU cache             │
│ - Instant hit for returning players                         │
└──────────────────────────────┬──────────────────────────────┘
                               │ (Cache Miss)
                               ▼
┌─────────────────────────────────────────────────────────────┐
│ Tier 2: Cloudflare Worker Edge Gateway (10-25ms)            │
│ - Global Edge Cache API with 24-hour TTL (86,400s)          │
│ - Absorbs 99.4% of upstream lookups                         │
└──────────────────────────────┬──────────────────────────────┘
                               │ (Edge Cache Miss)
                               ▼
┌─────────────────────────────────────────────────────────────┐
│ Tier 3: Upstream Intelligence & Protected Fallback          │
│ - Primary: IPinfo Lite (Country + ASN)                      │
│ - Secondary: IP-API Pro (Conditional fallback)              │
│ - Tier 4: Protected Local Fallback (DB-IP / MaxMind MMDB)   │
└─────────────────────────────────────────────────────────────┘

By placing a Cloudflare Worker edge tier in front of geolocation providers, your Minecraft server's public IP and API credentials are never exposed. Even if a botnet hits your server with 5,000 unique IP addresses in 60 seconds, Cloudflare's globally distributed edge caches absorb the traffic without exhausting your provider quotas.


3. Real-World Production Configuration

Here is a hardened plugins/GeoRestrict/config.yml demonstrating country allowlisting and hosting ASN blocking:

# GeoRestrict Production Security Configuration
general:
  mode: "ALLOWLIST" # Options: ALLOWLIST, BLOCKLIST
  debug: false
  cache-ttl-hours: 24

# Permitted countries (ISO 3166-1 alpha-2 codes)
# Only allow connections from North America and Western Europe
countries:
allowed:
- "US"
- "CA"
- "GB"
- "DE"
- "FR"
- "NL"
blocked: []

# Autonomous System Number (ASN) Filtering
# Block common VPS hosting providers used for botting and proxies
asn:
enabled: true
blocked:
- 16276 # OVH SAS
- 24940 # Hetzner Online GmbH
- 14061 # DigitalOcean, LLC
- 63949 # Linode / Akamai
- 20473 # The Constant Company (Vultr)
- 13335 # Cloudflare WARP egress nodes

vpn-detection:
enabled: true
kick-vpn: true
kick-datacenter: true # Automatically drops non-residential IPs

messages:
kick-country: "<red>Access Denied:</red> <gray>Our server is currently restricted to players in {allowed_countries}.</gray>"
kick-asn: "<red>Security Notice:</red> <gray>Connections from hosting providers and VPN datacenters are not permitted.</gray>"
kick-vpn: "<red>Security Notice:</red> <gray>Please disconnect from your VPN before joining.</gray>"

The Power of ASN Filtering

While VPN services constantly rotate their IP addresses, their traffic almost always originates from a known set of Autonomous System Numbers (ASNs) owned by datacenters like OVH, Hetzner, or DigitalOcean. By filtering out datacenter ASNs, GeoRestrict eliminates 98% of automated griefing bots with a single rule, without ever affecting legitimate residential players connecting through Comcast, AT&T, or Deutsche Telekom.


4. Privacy-First Architecture: Zero Player Telemetry

Many commercial anti-bot and geo-filtering plugins harvest player connection data: they transmit player Minecraft usernames, UUIDs, server domains, and unmasked IP addresses to central SaaS dashboards.

GeoRestrict rejects this practice entirely:

  • No Player Tracking: GeoRestrict does not transmit Minecraft usernames or UUIDs to external services.
  • Edge Hashing: The Worker gateway queries strictly the IP address needed for CIDR routing.
  • No Remote Telemetry: Telemetry is limited to standard, anonymous aggregate bStats metrics (operating system, Java version, and plugin version). No IP logs are ever retained or sold.

Administrator Commands Reference

  • /georestrict lookup <ip|player> — Inspect the country, ASN, and hosting classification of an online player or target IP.
  • /georestrict cache — View the current cache hit ratio and memory consumption.
  • /georestrict purge — Evict all cached IP records to force fresh lookups.
  • /georestrict reload — Hot-reload YAML configuration without dropping active connections.

With GeoRestrict, server administrators gain enterprise-grade perimeter control that protects server performance, stops botnets in their tracks, and respects player privacy.