This guide shows you how to detect VPN, proxy, TOR, and bot IP addresses in Ruby using the standard library's Net::HTTP and the Focsec API.
Works great with Rails, Sinatra, or any Ruby application where you need to identify anonymous visitors.
Check an IP for VPN or proxy
Use Ruby's built-in Net::HTTP to query the Focsec API.
Create your free account to get an API key.
API Response
The response is a hash containing threat flags and geolocation details:
Detect suspicious IPs
Create a helper method to identify VPN, proxy, TOR, or bot connections:
Rails controller example
Block VPN users from sensitive actions in a Rails controller:
Next steps
Your Ruby application is ready to detect VPN and proxy traffic. Head over to the API Reference for the complete documentation.
Sign up for a free account and start detecting VPNs, proxies, and bots in your application.
Get your API key »