# Pre-wake WAF & edge security

> In-path OWASP Core Rule Set WAF blocking, adaptive proof-of-work browser challenges, declarative edge caching, and replayable trace tests that reject hostile traffic before waking parked compute.

Category: Edge protection · Maturity: GA & Beta · Plans: Free+ (edge rules), Hobby+ (challenge), Pro+ (WAF) · Updated 2026-11-26

On scale-to-zero platforms without edge enforcement, every scanner probe or credential-stuffing burst wakes a container and bills compute. Gregale evaluates WAF rules, rate limits, IP/country/token checks, and browser challenges in the public edge path so blocked requests receive 403 at $0 compute cost.

## Trace and test edge rules locally or against a live project environment

```bash
# Replay a versioned edge-rule scenario from a JSON file
gregale edge rule trace my-api --file ./edge-trace.json

# Or trace a live project environment against its effective policy
gregale edge rule trace my-api --project shop --environment staging --url https://staging.shop.gregale.app/search
```

## Key capabilities

- **In-path OWASP WAF blocking:** kind=waf rules on Pro and Scale inspect matched headers and URLs against the OWASP Core Rule Set (SQLi, XSS, path traversal, scanners). Block mode rejects with 403 before waking your app at paranoia level 1; paranoia level 2 runs in observe-only preview.
- **Zero-third-party browser challenge:** kind=challenge stops scrapers with a lightweight proof-of-work check and signed pass cookie on custom domains too, while verified API keys, consumer keys, and JWTs pass without friction.
- **Replayable edge rule trace & rollback:** Verify how a request matches your rules before pushing changes using gregale edge rule trace scenarios, and inspect rule revision history or roll back anytime.
- **Declarative edge response cache:** Cache selected GET and HEAD responses at the edge with bounded freshness, stale-while-revalidate, and explicit purges so repeated reads never wake an instance.

## Typical PaaS vs. Gregale

| Capability | Typical PaaS | Gregale |
|---|---|---|
| Requests blocked before app wake | Traffic reaches container or requires external WAF proxy | Refused at the edge (403); parked microVM stays at $0 |
| OWASP Core Rule Set WAF | Usually an enterprise add-on or external CDN layer | Built-in kind=waf rules with observe, warn, and block modes |
| Scraper challenge without CAPTCHA SaaS | External CAPTCHA scripts or Cloudflare enterprise config | Native proof-of-work pass cookie that exempts API keys & JWTs |

## Documentation

- [Security & WAF](https://gregale.dev/docs/security.md)
- [Edge rules](https://gregale.dev/docs/edge-rules.md)
- [Edge rule trace](https://gregale.dev/docs/edge-rule-trace.md)
- [Response caching](https://gregale.dev/docs/cache.md)

## Related guides

- [edge-rules-rate-limiting-trace-testing](https://gregale.dev/articles/edge-rules-rate-limiting-trace-testing.md)
- [declarative-edge-response-cache](https://gregale.dev/articles/declarative-edge-response-cache.md)
- [ssrf-protection-egress-denylist-paas](https://gregale.dev/articles/ssrf-protection-egress-denylist-paas.md)

## Runnable starters on GitHub

- [Edge WAF, Bot Challenge & Spend Caps](https://github.com/gregale-dev/edge-waf-rate-limit-starter) (Node 22 · Edge Rules & Trace Fixtures): Pre-wake OWASP CRS WAF, proof-of-work scraper challenge, failure-only composite login throttle, edge response cache, and versioned trace fixtures for gregale edge rule trace.
- [setup-gregale GitHub Action](https://github.com/gregale-dev/setup-gregale) (GitHub Action · @v1): Composite GitHub Action that installs the Gregale CLI, masks optional bearer credentials, and pairs with edge-rule-trace and deploy verification workflows.

Browse all starters: https://gregale.dev/templates.md

## Frequently asked questions

### Do blocked requests wake a parked Gregale app or count toward my bill?

No. Requests refused at the edge by WAF block rules, browser challenges, rate limits, or access controls never wake your Firecracker microVM and cost nothing.

### Which plans include WAF and browser challenge rules?

General edge rules and rate limits are available across plans including Free. Browser challenges (kind=challenge) unlock on Hobby, Pro, and Scale (up to 3, 10, and 25 rules). OWASP WAF rules (kind=waf) unlock on Pro and Scale, with observe/warn/block available per account rollout at paranoia level 1.

### Will browser challenge rules break API clients calling my backend?

No. Requests carrying a verified API key, consumer key, or JWT bypass the browser challenge automatically so programmatic clients keep working.

Canonical URL: https://gregale.dev/features/edge-security
