@@ -67,7 +67,7 @@ virtualenv or system-wide using:
6767
6868.. code-block :: none
6969
70- pip install dist/hrw4u-1.0.0-py3-none-any.whl
70+ pipx install dist/hrw4u-1.0.0-py3-none-any.whl
7171
7272 Using
7373-----
@@ -91,7 +91,8 @@ Syntax Differences
9191The basic structure is a `section ` name defining the part of the transaction to run in
9292followed by conditionals and operators. It uses `if () {} else {} ` conditional syntax
9393with `&& , || and == `, with conditions and operators generally following function() or
94- object.style grammar. For instance:
94+ object.style grammar. Operator lines are terminated with `; ` (whitespace is still not
95+ significant). For instance:
9596
9697.. code-block :: none
9798
@@ -167,6 +168,7 @@ cond %{SSN-TXN-COUNT} >10 ssn-txn-count() > 10 Number of tra
167168cond %{TO-URL:<C>} =bar to.url.<C> == "bar" Remap ``To URL `` component match, ``C `` is ``host `` etc.
168169cond %{TXN-COUNT} >10 txn-count() > 10 Number of transactions on client connection
169170cond %{URL:<C> =bar {in,out}bound.url.<C> == "bar" Context aware URL component match
171+ cond ${GEO:<C>} =bar geo.<C> == "bar" IP to Geo mapping. ``C `` is ``country ``, ``asn `` etc.
170172=============================== ================================== ================================================
171173
172174The conditions operating on headers and URLs are also available as operators. E.g.:
@@ -180,10 +182,14 @@ The conditions operating on headers and URLs are also available as operators. E.
180182 In general, where it makes sense for the condition to be used as an operator, it is available as an operator.
181183The rule of thumb is the conditional is an operator if the value is mutable.
182184
185+ .. note ::
186+ Each parenthesis group in a conditional will produce a GROUP. Thus, the original header_rewrite
187+ config will be more readable with ``if ... `` than `if (...) `.
188+
183189Operators
184190---------
185191
186- Operators in ``header_rewrite `` mapt to HRW4U as a mix of assignments and function calls.
192+ Operators in ``header_rewrite `` map to HRW4U as a mix of assignments and function calls.
187193The preference is the assignment style when appropriate.
188194
189195============================= ================================= ================================================
@@ -220,6 +226,15 @@ set-debug set-debug() Enables ATS txn debug
220226skip-remap skip-remap() Skip remap processing (open proxy)
221227================= ============================ ================================
222228
229+ String concatenations
230+ ---------------------
231+
232+ You can concatenate values using strings, condition values and variable expansions on the same line in
233+ operators using. For instance, `outbound.req.CustomHeader “Hello from {inbound.ip}:{inbound.port}” `. As
234+ a result, the set-redirect's `[QSA] ` flag would be implemented as `set-redirect(302, "https://...?{inbound.url.query}")``.
235+ Note the presence of the `? ` -- the url.query doesn't include it.
236+
237+
223238Semantics
224239=========
225240
@@ -246,7 +261,8 @@ A special section `VARS` is used to declare variables. There is no equivalent in
246261`header_rewrite `, where you managed the variables manually.
247262
248263.. note ::
249- The section name is always required in HRW4U, there are no implicit or default hooks.
264+ The section name is always required in HRW4U, there are no implicit or default hooks. There
265+ can be several if/else block per section block.
250266
251267Groups
252268------
0 commit comments