Simulate

Simulate HTTP requests through a workspace's WAF configuration without sending actual traffic. This allows testing and validating WAF rule behavior in a safe, non-production context.

IMPORTANT: The Fastly Next-Gen WAF API is only available to customers with access to the Next-Gen WAF product in the Fastly control panel. If you have access to the Next-Gen WAF control panel, check out the Next-Gen WAF API.

Known limitations

The simulator is stateless and processes one request at a time. It uses the on-prem agent WAF engine, not the edge-deployed WebAssembly runtime. As a result, it cannot evaluate:

  • Rate limiting rules (require cross-request state)
  • Deception actions (require traffic routing infrastructure)
  • Edge WAF rules (different runtime)
  • Informational signal filtering (signals converted to metrics counters by the WAF engine)

Data model

Request body for simulating a WAF request. The total request body must not exceed 100 KB.

requeststringThe raw HTTP request in wire format to simulate through the WAF. Must include the request line, headers, and optionally a body, separated by CRLF sequences. Required.
responsestringThe raw HTTP response in wire format. The WAF engine inspects response headers during its PostRequest phase and may generate signals from them. When omitted, a default response of HTTP/1.1 200 OK\r\n\r\n is used.
signalsarrayList of signals detected by the WAF during simulation. Empty array when no signals are detected.
waf_responseintegerThe HTTP status code the WAF would return for the simulated request (e.g., 200 for allowed, 406 for blocked).
detectorstringThe detector engine that identified the signal (e.g., SQLI, LIBINJECTIONV5, LIBINJECTIONJS, or a rule ID).
locationstringWhere in the request the signal was detected (e.g., QUERYSTRING, POSTBODY, HEADER, HEADEROUT, POSTARG). Present for detection signals; absent for custom and action signals.
namestringThe parameter or header name that triggered detection. Present when the WAF engine identifies a specific parameter or header.
redactionstringThe redaction level applied to the detected value. Clients should handle unexpected string values gracefully, as new redaction types may be added.
typestringThe type of signal detected (e.g., SQLI, XSS, CMDEXE, TRAVERSAL, BACKDOOR, LOG4J-JNDI, BLOCKED).
valuestringThe matched payload value that triggered signal detection. For detection signals, contains the matched content. For BLOCKED signals, carries the WAF response code as a string. Absent for custom signals.

Endpoints

Simulate a WAF request

POST/ngwaf/v1/workspaces/workspace_id/simulate