Skip to Content
Heels LogoHeelsDocs
Security & Limits

Rate Limiting & Origin Security

Protect your notification channels against spam, bot floods, and unauthorized origin submissions.

Rate Limiting & Origin Security

Because form endpoints on public websites are inherently exposed to the internet, Heels implements multi-layered security controls to shield your notification channels and email quotas from abuse.


1. Allowed Origins (CORS & Whitelisting)

Every integration has an Allowed Origins configuration. When an event arrives at POST /events/:integration_id, service-publisher extracts the client domain from the following HTTP headers:

  1. Origin
  2. Referer (fallback for older browsers or standard form submissions)
Rendering diagram...

Whitelist Rules:

  • Wildcard (*): Disables origin verification. Recommended only for local development or mobile apps where headers may be absent.
  • Exact Domain (https://example.com): Strictly allows requests with matching origin or referer prefix.
  • Multiple Domains: You can specify an array of permitted domains (e.g. production, staging, and preview deployments).

Strict Origin in Production

Always configure exact domain origins for public production forms. If an unauthorized domain copies your form code and tries to submit spam through your integration, Heels will immediately reject it with HTTP 403 Forbidden.


2. Rate Limiting

Heels applies IP-based rate limiting backed by Redis.

How It Works

  • Identification: Client IP is extracted from x-forwarded-for or x-real-ip (falling back to TCP socket address).
  • Configurable Thresholds: Each integration can define:
    • max_requests: e.g., 5 submissions.
    • window_seconds: e.g., 60 seconds.
  • Enforcement: If a client exceeds the quota within the active time window, the server returns HTTP 429 Too Many Requests.
{
  "success": false,
  "error": "Rate limit exceeded. Please wait before submitting again."
}

3. Payload Size Cap

To guard against Denial of Service (DoS) memory exhaustion attacks, service-publisher enforces a strict 10 MB payload limit on all incoming HTTP request bodies:

// service-publisher 10MB streaming limit
let body_bytes = to_bytes(request.into_body(), 10 * 1024 * 1024).await?;

Requests exceeding 10 MB are rejected immediately with HTTP 400 Bad Request.


4. Honeypot Spam Suppression

As detailed in Direct HTML Form Action, include the invisible _gotcha field in your HTML forms. Automated bot scripts populate every input tag they encounter:

<input type="text" name="_gotcha" style="display:none !important;" tabindex="-1" autocomplete="off" />

When _gotcha contains any characters, Heels returns a standard HTTP success response to the bot but drops the notification, keeping your Telegram and inbox noise-free.

On this page