Apache Gone

April 4, 2026 · View on GitHub

License

Apache Gone

An Apache httpd module that returns HTTP 410 Gone for URIs listed in a map file. Port of nginx-gone for Apache.

Features

  • Simple map file — one URI per line, read once at config load
  • Exact matching — O(1) hash table lookup for exact URIs
  • Regex matching — PCRE patterns with ~ (case-sensitive) and ~* (case-insensitive)
  • Per-context control — enable/disable at server or directory/location level
  • Early interception — translate_name hook, before content handlers
  • No dependencies — pure Apache API (APR), no external libraries
  • Dynamic module — works with LoadModule
  • nginx map compatible — reuse existing map files (second column ignored)

Documentation & Support

📖 Wiki - Guides, tutorials, and reference

💬 Discussions - Questions, help, and feedback

Quick Start

1. Install

Debian/Ubuntu:

# Add the OBS repository (see Installation Guide for details)
apt install apache-gone

Fedora/RHEL:

# Add the OBS repository (see Installation Guide for details)
dnf install apache-gone

2. Create a map file

cat > /etc/apache2/maps/gone.map <<EOF
# Removed blog posts
/blog/2020/deleted-post 1
/blog/2019/old-article 1

# Discontinued products
/products/old-widget 1

# Regex: everything under /deprecated/
~^/deprecated/ 1

# Case-insensitive: old PHP pages
~*^/old-(.*)\.php$ 1
EOF

3. Configure Apache

LoadModule gone_module modules/mod_gone.so

# Load the gone URI map (read once at startup / reload)
GoneMapFile /etc/apache2/maps/gone.map

<VirtualHost *:80>
    ServerName example.com
    GoneEnabled on

    DocumentRoot /var/www/html

    # Disable gone checking for the API
    <Location /api>
        GoneEnabled off
    </Location>
</VirtualHost>

4. Test

apachectl configtest && apachectl graceful
curl -I http://example.com/blog/2020/deleted-post
# HTTP/1.1 410 Gone

Configuration Reference

DirectiveContextDefaultDescription
GoneEnabledserver, directory, locationoffEnable/disable gone checking
GoneMapFileserver configPath to URI list file
GoneUseRequestUriserver configoffMatch original request URI instead of decoded URI

Map File Format

# Comments start with #
/exact/path 1              # Exact match
~^/regex/pattern 1         # Case-sensitive regex
~*^/case-insensitive 1     # Case-insensitive regex
  • One URI per line
  • Second column is optional (ignored, for nginx map compatibility)
  • ~ prefix = case-sensitive PCRE regex
  • ~* prefix = case-insensitive PCRE regex
  • Everything else = exact string match

Building from Source

cd src
apxs -i -a -c mod_gone.c

Repository Structure

  • src/ — Apache module source code
  • conf/ — Example configuration
  • test/ — Test suite
  • debian/ — Debian packaging files
ModuleDescriptionGitHub
apache-cf-realipAutomatic Cloudflare IP list for RemoteIPTrustedProxyGitHub
apache-torblockerControl access from Tor exit nodesGitHub
apache-wafIP/CIDR-based access control with named listsGitHub
apache-waf-apiREST API daemon for dynamic IP list managementGitHub
apache-waf-feedsAutomatic threat feed updaterGitHub
apache-waf-uiWeb management interfaceGitHub

nginx Counterparts

nginx ModuleApache Module
nginx-goneapache-gone (this project)
nginx-cf-realipapache-cf-realip
nginx-torblockerapache-torblocker
nginx-wafapache-waf

License

Apache License 2.0. See LICENSE.md.