Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions doc/admin-guide/configuration/hrw4u.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ Syntax Differences
==================

The basic structure is a `section` name defining the part of the transaction to run in
followed by conditionals and operators. It uses `if () {} else {}` conditional syntax
followed by conditionals and operators. It uses `if () {} elif () {} else {}` conditional syntax
with `&& , || and ==`, with conditions and operators generally following function() or
object.style grammar. Operator lines are terminated with `;` (whitespace is still not
significant). For instance:
object.style grammar. Conditionals can be nested up to a maximum depth of 10 levels. Operator
lines are terminated with `;` (whitespace is still not significant). For instance:

.. code-block:: none

Expand All @@ -107,13 +107,31 @@ significant). For instance:
}

REMAP {
if inbound.status == 403 || access("/etc/lock") {
if inbound.status == 403 {
inbound.req.X-Fail = "1";
} elif inbound.status == 404 {
inbound.req.X-NotFound = "1";
} else {
no-op();
}
}

READ_RESPONSE {
if inbound.status >= 400 {
if inbound.status < 500 {
# Client error - check specific cases
if inbound.status == 404 {
counter("errors.not_found");
} elif inbound.status == 403 {
counter("errors.forbidden");
}
} else {
# Server error
counter("errors.server");
}
}
}

There is no `cond` or `set-header` syntax — those are implied by context.

Header Presence
Expand Down Expand Up @@ -158,7 +176,7 @@ Syntax Free-form Structured `if (...) { ... }`
Conditions `cond %{...}` Implicit in `if (...)`
Operators Raw text (`set-header`) Structured assignments or statements
Grouping `GROUP` / `GROUP:END` Use `()` inside `if` expressions
Else branches `else` with indented ops `else { ... }` with full block
Else branches `else` with indented ops `elif { ... }` and `else { ... }` with full blocks
Debugging Manual with logs Built-in debug tracing (`--debug`)
Quotes Quoted strings optional Quoted strings required / encouraged
Validation Runtime Static during parsing and symbol resolution
Expand Down