Skip to content

Phase Flow in Peakhour.IO

This diagram illustrates the order and flow of phases in Peakhour.IO's request processing pipeline.

graph TD
    A[Incoming Request] --> B(Request Rewrite)
    B --> C(URL Config)
    C --> D(Firewall)
    D --> E(Rate Limit Request)
    E --> WAF(WAF)
    WAF --> EL(Rate Limit Request Late)
    EL --> BR(Bulk Redirect)
    BR --> F(Request Headers)
    F --> G(Load Balance)
    G --> H[Origin Processing]
    H --> I(Response Headers)
    I --> J(Rate Limit Response)
    J --> K[Outgoing Response]

    style A fill:#f9f,stroke:#333,stroke-width:2px
    style K fill:#9ff,stroke:#333,stroke-width:2px
    style H fill:#ff9,stroke:#333,stroke-width:2px

Phase Descriptions

  1. Request Rewrite: Modifies the request URI.
  2. URL Config: Applies configuration overrides based on the URL.
  3. Firewall: Allows, blocks, challenges, or logs requests based on security rules.
  4. Rate Limit Request: Applies rate limiting before the WAF.
  5. WAF: Analyzes the request for threats against the OWASP Core Rule Set.
  6. Rate Limit Request Late: Applies rate limiting after the WAF has run, allowing for decisions based on WAF results.
  7. Bulk Redirect: Manages large-scale URL redirects.
  8. Request Headers: Modifies or sets headers in the incoming request.
  9. Load Balance: Distributes incoming requests across multiple origin servers.
  10. Origin Processing: The request is sent to and handled by the origin server.
  11. Response Headers: Modifies or sets headers in the outgoing response from the origin.
  12. Rate Limit Response: Applies rate limiting based on the response from the origin.

Peakhour-Specific Fields

Location Field

The peakhour.server.name field contains the POP server name that handled the request. This field enables origin selection based on region.

Example usage:

peakhour.server.name == "SYD1"

Action:

  lb.origin_pool.set:
    pool: "australia_servers"

Proxy Field

The peakhour.client.proxy field detects if the client is using a residential proxy.

Example usage:

peakhour.client.proxy

Action:

  firewall.challenge:
    reason: "Proxy detected"

Firewall Challenge

The firewall phase includes a challenge action for potentially suspicious requests:

user_agent.bot and not bot.verified:

Action:

  firewall.challenge:
    reason: "Unverified bot"

Dynamic Headers

Dynamic headers set header values using Wirefilter expressions.

Example:

http.request.headers.set:
  X-User-Location: ${concat(ip.geoip.country, "-", ip.geoip.asnum)}

This sets the X-User-Location header with the country code and AS number of the requesting IP.