The various rewrite options of each mapping configuration make it possible to change certain HTTP header fields or HTML contents on the fly during a request. All rewrite options are defined with regular expressions. Airlock Gateway only activates the rewrite engine for the needed sections. If no HTML rewriting is configured for a mapping, Airlock Gateway will not even parse the HTML response to achieve best performance.
You can make use of the rewrite variables in regular expression patterns or in substitution strings.
Rewrite options contain the following activation options:
- Translate Internal Address (rewrite option with default behavior enabled)
- Custom (rewrite option with custom rules enabled)
- Off (rewrite option disabled)
The default rules can be made visible by selecting the custom mode and clicking on the Translate Internal Address button. The Translate Internal Address rules provide recommended values to achieve best compatibility with back-end applications that are not reverse proxy compatible.
Each rule consists of a regular expression From pattern and a corresponding substitution To string. A matching expression pattern is replaced by the substitution string. Replaced is the whole regular expression match which may be a substring of the whole input field. Parenthesis in the regular expressions may be used to be referenced in the target string. They can be placed in the substitution string by using the numbered dollar sign variables ($1..$9). Currently up to ten match references can be used. Multiple rewrite rules can be added by using the + button at the bottom of the table. The rewrite rules are applied in the listed order. Use the mouse and drag a rule on the right of the - sign, drop it on a new position to sort the list and therefore change the order of execution.
Simple rewrite example:
From ^/(.*)$
To /prefix-example/$1
This example matches absolute path input strings and puts a prefix in front of it.