Macro Expansion
Prev | Home | Next

## Macro Expansion

Macros allow for using place holders in rules that will be expanded out to their values at runtime. Currently only variable expansion is supported, however more options may be added in future versions of ModSecurity.

Format:

    %{VARIABLE}
    %{COLLECTION.VARIABLE}

Macro expansion can be used in actions such as initcol, setsid, setuid, setvar, setenv, logdata. Operators that are evaluated at runtime support expansion and are noted above. Such operators include @beginsWith, @endsWith, @contains, @within and @streq. You cannot use macro expansion for operators that are "compiled" such as @pm, @rx, etc. as these operators have their values fixed at configure time for efficiency.

Some values you may want to expand include: TX, REMOTE_ADDR, USERID, HIGHEST_SEVERITY, MATCHED_VAR, MATCHED_VAR_NAME, MULTIPART_STRICT_ERROR, RULE, SESSION, USERID, among others.

Prev |  | Next
Operators | Home | Persistant Storage

Copyright (C) 2004-2009 Breach Security