mod_asn is an Apache module that uses BGP routing data to look up the autonomous system (AS) and the network prefix (subnet) which contains a given (client's) IP address. mod_asn is highly scalable. To do lookups in high-speed, it uses the PostgreSQL ip4r datatype, which is indexable with a Patricia Trie algorithm to store network prefixes. This is the most suitable algorithm, being able to search through around 250,000 existing prefixes quickly. mod_asn is usable as a standalone module, and the lookup result can be used by scripts or other Apache modules. For instance, a download redirector could base its decisions on the lookup result provided by mod_asn.