Doorman
DocsGet StartedGitHub

© 2025 griffen.codes

DiscordIssuesGitHub
    Documentation

    Getting Started

    • Getting Started

    Configuration

    • Configuration
    • Templates
    • Examples

    Commands

    • Commands Overview

    Guides

    • CI/CD Integration
    • Cloudflare Setup
    • Cloudflare Migration
    View on GitHub Wiki
    Docs/Configuration/Configuration
    Configuration

    Configuration

    Learn about the JSON configuration file format, rules, conditions, and actions.

    Edit on GitHub

    Vercel Doorman uses a JSON configuration file to define your firewall rules. The configuration is validated using JSON Schema and provides full TypeScript support.

    Schema URL

    Add the schema reference to your config file for editor autocompletion and validation:

    json
    {
      "$schema": "https://doorman.griffen.codes/schema.json"
    }

    Basic Structure

    Vercel Configuration

    json
    {
      "$schema": "https://doorman.griffen.codes/schema.json",
      "projectId": "prj_abc123",
      "teamId": "team_xyz789",
      "rules": [],
      "ips": []
    }

    Cloudflare Configuration

    json
    {
      "$schema": "https://doorman.griffen.codes/schema.json",
      "provider": "cloudflare",
      "providers": {
        "cloudflare": {
          "zoneId": "zone_abc123",
          "accountId": "acc_xyz789"
        }
      },
      "rules": [],
      "ips": []
    }

    Multi-Provider Configuration

    json
    {
      "$schema": "https://doorman.griffen.codes/schema.json",
      "provider": "cloudflare",
      "providers": {
        "vercel": {
          "projectId": "prj_abc123",
          "teamId": "team_xyz789"
        },
        "cloudflare": {
          "zoneId": "zone_abc123",
          "accountId": "acc_xyz789"
        }
      },
      "rules": [],
      "ips": []
    }

    Root Properties

    PropertyTypeRequiredDescription
    $schemastringNoJSON Schema URL for validation
    providerstringNoDefault provider ("vercel" or "cloudflare")
    projectIdstringVercel OnlyVercel project ID
    teamIdstringVercel OnlyVercel team ID (optional)
    providersobjectMulti-ProviderProvider-specific configurations
    rulesarrayYesArray of firewall rules
    ipsarrayNoArray of IP blocking rules
    versionnumberNoConfiguration version
    firewallEnabledbooleanNoEnable/disable firewall

    Rules

    Rule Structure

    json
    {
      "id": "rule_block_bots",
      "name": "Block Bad Bots",
      "description": "Block malicious bots and crawlers",
      "active": true,
      "conditionGroup": [
        {
          "conditions": [
            {
              "type": "user_agent",
              "op": "sub",
              "value": "bot",
              "neg": false
            }
          ]
        }
      ],
      "action": {
        "mitigate": {
          "action": "deny"
        }
      }
    }

    Rule Properties

    PropertyTypeRequiredDescription
    idstringNoUnique rule identifier
    namestringYesHuman-readable rule name
    descriptionstringNoRule description
    activebooleanYesWhether rule is enabled
    conditionGrouparrayYesArray of condition groups (OR logic)
    actionobjectYesAction to take when rule matches

    Condition Groups

    Condition groups use OR logic between groups and AND logic within groups:

    json
    {
      "conditionGroup": [
        {
          "conditions": [
            { "type": "path", "op": "pre", "value": "/admin" },
            { "type": "method", "op": "eq", "value": "POST" }
          ]
        },
        {
          "conditions": [
            { "type": "ip_address", "op": "eq", "value": "192.168.1.1" }
          ]
        }
      ]
    }

    This translates to: (path starts with "/admin" AND method equals "POST") OR (IP equals "192.168.1.1")

    Condition Types

    TypeDescriptionVercelCloudflare
    hostHostname✅✅
    pathURL path✅✅
    methodHTTP method✅✅
    headerHTTP header✅✅
    queryQuery parameter✅✅
    cookieCookie value✅✅
    user_agentUser agent string✅✅
    ip_addressIP address✅✅
    geo_countryCountry code✅✅
    geo_continentContinent code✅✅
    geo_cityCity name✅✅
    protocolProtocol✅✅
    schemeURL scheme✅✅
    environmentDeployment environment✅❌
    regionVercel region✅❌

    Operators

    OperatorDescriptionVercelCloudflare
    eqEquals✅✅
    preStarts with✅✅
    sufEnds with✅✅
    subContains✅✅
    incIs any of (array)✅✅
    reRegex match✅⚠️ Enterprise
    exExists✅✅
    nexDoes not exist✅✅

    Actions

    ActionDescriptionVercelCloudflare
    logLog only✅✅
    denyBlock request✅✅
    allowAllow request✅✅
    challengeCAPTCHA challenge✅✅
    bypassSkip other rules✅✅
    rate_limitRate limiting✅✅
    redirectHTTP redirect✅✅

    Rate Limiting

    json
    {
      "action": {
        "mitigate": {
          "action": "rate_limit",
          "rateLimit": {
            "requests": 100,
            "window": "60s"
          }
        }
      }
    }

    Redirect

    json
    {
      "action": {
        "mitigate": {
          "action": "redirect",
          "redirect": {
            "location": "https://example.com/blocked",
            "permanent": false
          }
        }
      }
    }

    IP Blocking Rules

    json
    {
      "ips": [
        {
          "id": "ip_block_suspicious",
          "ip": "192.168.1.100/32",
          "hostname": "suspicious-host",
          "action": "deny",
          "notes": "Blocked due to suspicious activity"
        }
      ]
    }
    PropertyTypeRequiredDescription
    ipstringYesIP address or CIDR range
    hostnamestringNoHostname for documentation
    actionstringYesAction (currently only "deny")
    notesstringNoNotes about the block

    Environment Variables

    Vercel

    bash
    VERCEL_TOKEN="your_vercel_token"
    VERCEL_PROJECT_ID="prj_abc123"
    VERCEL_TEAM_ID="team_xyz789"

    Cloudflare

    bash
    CLOUDFLARE_API_TOKEN="your_api_token"
    CLOUDFLARE_ZONE_ID="zone_abc123"
    CLOUDFLARE_ACCOUNT_ID="acc_xyz789"

    Provider Selection

    bash
    DOORMAN_PROVIDER="cloudflare"  # or "vercel"

    Best Practices

    1. Use descriptive names for rules and IPs
    2. Add descriptions to explain rule purposes
    3. Group related conditions logically
    4. Use CIDR notation for IP ranges
    5. Order rules by frequency (most common first)
    6. Test rules in staging before production
    7. Start with log actions before blocking
    8. Keep backups of working configurations

    Related Pages

    • Getting Started — Quick setup guide
    • Commands Overview — CLI command reference
    • Examples — Real-world configuration examples

    This content is sourced from the GitHub Wiki.

    PreviousGetting StartedNextTemplates