Skip to content
Smarter by Design.Simpler for Business

lb action ​

The lb action command manages the actions to be applied to the traffic: adding and changing a header, redirection, blocking, showing content, rate and bandwidth limiting, logging and more. Its panel equivalent is the Actions section.

An action does not work on its own: it is bound to a vService and is applied there by being matched with a condition.

The first field written is type

In this command the type is selected first, the name of the record is asked for after it. Without the type being written, the name field is not listed.

Command Summary ​

TR7 WEB-CLI · lb action
# Tab after the command
admin@TR7LBWAF01> lb action
add delete list show update
 
admin@TR7LBWAF01> lb action list # list all of them
admin@TR7LBWAF01> lb action show <id> # show one
admin@TR7LBWAF01> lb action add type <type> name <name> … # new action
admin@TR7LBWAF01> lb action update id <id> … # change
admin@TR7LBWAF01> lb action delete <id> # delete
admin@TR7LBWAF01>  

Writing Order ​

Step 1 Select the type
lb action add type add_header

There are thirty-seven types; Tab lists them all. After the type is selected, only the fields of that type are asked for.
Step 2 Write the name
name add-client-ip
Step 3 Write the fields of the type
In most types there is no additional required field; the ones that have them are marked in the table below.
Step 4 Bind it to a vService
lb service update id <vService> --rules.0 <action>

Required Fields ​

OrderFieldStatusValue
1typeRequiredThe action type; one of 37 values
2nameRequiredThe name of the action
3mirrorBackendConditionally requiredOnly mirror; the backend to which the copy will be sent
3 · 4headerNameToAdd · headerContentConditionally requiredOnly add_header; the header name and its content
3–5headerNameToEdit · headerContent · headerNameToDeleteConditionally requiredOnly set_header
3–5headerNameToReplace · headerReplaceRegex · headerReplaceContentConditionally requiredOnly replace_header
3trafficInspectionTagConditionally requiredOnly advancedTrafficInspection
3matcherConditionally requiredOnly modifyResponse
3manualRuleContentConditionally requiredOnly manualRule
3redirectLocConditionally requiredreq_redirect_location · error_redirect_at_tm · error_redirect_at_res; the redirection address
3newPathConditionally requiredset_path · set_pathq; the new path
3cookieNameConditionally requiredOnly cookie_based

The action type is a discriminator in this command: all the fields in the table are written without a prefix even if there is a field starting with -- in the line, and the CLI does not accept any field starting with -- until the required fields specific to the type are completed. In the types that are not in the list there is no additional required field.

The Action Types ​

The table below is the map of the types: the command value, its equivalent in the panel and the additional required fields asked for after the name. All the fields of every type are given in the sections under this table.

typePanel equivalentAdditional required fields
add_headerAdd HTTP HeaderheaderNameToAdd · headerContent
set_headerSet HTTP HeaderheaderNameToEdit · headerContent · headerNameToDelete
replace_headerReplace HTTP Header ContentheaderNameToReplace · headerReplaceRegex · headerReplaceContent
del_headerDelete HTTP Header—
headerFixHTTP Header 1.0 Compatibility—
keepHeaderNamesKeep Header Names—
securityHeadersManage HTTP Security Headers—
corsCORS—
cookie_basedCookie Based Connection PersistencycookieName
cookieSecurityHTTP Cookie Security—
cookieEncryptionCookie Encryption—
set_pathSet PathnewPath
set_pathqSet Path + QuerynewPath
normalize_uriURL Normalization—
req_redirect_locationLocation RedirectionredirectLoc
redirect_schemeRedirect to HTTPS—
error_redirect_at_tmRedirect for Traffic Manager ErrorsredirectLoc
error_redirect_at_resRedirect for Backend Service ErrorsredirectLoc
showContentShow Content—
error_file_at_tmShow Content for Traffic Manager Errors—
error_file_at_resShow Content for Backend Service Errors—
denyBlock—
quarantine_tableQuarantine—
advancedCaptchaAdvanced CAPTCHA—
req_authUser Authentication on HTTP Request—
bandwidthRuleBandwidth Limitation—
tcp_conn_mgmtTCP Connection Management—
http-reuseHTTP/TCP Multiplexing—
mirrorTraffic MirroringmirrorBackend
set_variableCreate Traffic Variable—
advancedTrafficInspectionAdvanced Traffic InspectiontrafficInspectionTag
modifyResponseModify Response Contentmatcher
manualRuleManual ActionmanualRuleContent
silentLogConditional Silent Log—
ipMaskIP Log Masking—
ipFixIPFIX Log Sending—
prometheusServiceProvide Prometheus Service—

The Fields Repeated in Many Types ​

The five fields below belong not to a single type but to many types. Their meanings are the same in every type; in which type they are found appears in the tables in the type sections.

FieldPanel labelValue
--condAction conditionThe condition in which the action will be applied; it is built from the lb condition records
--ruleLocExecution levelatRequest · atResponse, default atRequest
--ruleProRule protocolhttp · tcp, default http
--countHitsHit countertrue · false, default false
--setVarOnHitSet variable on hitThe traffic variable to be written when the action is applied

The Fields Specific to the Type ​

Every type is listed with its own fields. The required fields are written without a slash, the optional fields with the -- prefix; if there is a field starting with -- in the line, the required fields take -- as well. The panel label column is the equivalent of the same field in the interface.

The Header Actions ​

add_header — Add HTTP Header

FieldStatusPanel labelValue
headerNameToAddRequiredHeader to addText
headerContentRequiredHeader contentText
--condOptionalAction conditionA condition expression
--ruleLocOptionalExecution levelatRequest · atResponse, default atRequest
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText

set_header — Set HTTP Header

FieldStatusPanel labelValue
headerNameToEditRequiredHeader to editText
headerContentRequiredHeader contentText
headerNameToDeleteRequiredHeader to deleteText
--condOptionalAction conditionA condition expression
--ruleLocOptionalExecution levelatRequest · atResponse, default atRequest
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText

replace_header — Replace HTTP Header Content

FieldStatusPanel labelValue
headerNameToReplaceRequiredHeader to replaceText
headerReplaceRegexRequiredRegex to matchText
headerReplaceContentRequiredReplacement contentText
--condOptionalAction conditionA condition expression
--ruleLocOptionalExecution levelatRequest · atResponse, default atRequest
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText
--headerReplaceTypeOptionalMatch typereplace-header · replace-value, default replace-header

del_header — Delete HTTP Header

FieldStatusPanel labelValue
--condOptionalAction conditionA condition expression
--ruleLocOptionalExecution levelatRequest · atResponse, default atRequest
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText

headerFix — HTTP Header 1.0 Compatibility

FieldStatusPanel labelValue
--headerFixContentOptionalHeaders to fixText, default Accept Accept-Auth Accept-Encoding Ac…

keepHeaderNames — Keep Header Names

It has no field specific to the type; the type and the name are enough.

securityHeaders — Manage HTTP Security Headers

FieldStatusPanel labelValue
--securityHeaderOptions.NOptionalResponse headers8 options (contentSecurityPolicy · strictTransportSecurity · xFrameOptions …)

cors — CORS

FieldStatusPanel labelValue
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText
--corsAllowedMethodsOptionalAllowed methodsText, default *
--corsAllowedOriginsOptionalAllowed originsText, default *
--corsAllowedHeadersOptionalAllowed headersText, default *

cookie_based — Cookie Based Connection Persistency

FieldStatusPanel labelValue
cookieNameRequiredCookie nameText
--cookieActionOptionalCookie actionSelected from the list, default insert
--cookieHttpOnlyOptionalMark as only HTTPtrue · false, default false
--cookieSecureOptionalMark as securetrue · false, default false
--cookieDomainOptionalCookie domain—
--cookieIndirectOptionalCreate indirectlytrue · false, default true
--cookieNoCacheOptionalNo cachetrue · false, default true
--cookiePostOnlyOptionalMark as post onlytrue · false, default false
--cookiePreserveOptionalPreserve cookietrue · false, default false
--cookieDynamicOptionalCookie is dynamictrue · false, default true
--cookieMaxIdle.valOptionalMax. idle time ValueA number (at least 0)
--cookieMaxIdle.unitOptionalMax. idle time unitSelected from the list, default ms
--cookieMaxLife.valOptionalMax. life time ValueA number (at least 0)
--cookieMaxLife.unitOptionalMax. life time unitSelected from the list, default ms
--cookieAttrOptionalCookie attributeText

cookieSecurity — HTTP Cookie Security

FieldStatusPanel labelValue
--cookieSecurityOptions.NOptionalCookie security optionsMore than one is selected from the list

cookieEncryption — Cookie Encryption

FieldStatusPanel labelValue
--cookiesToEncrypt.NOptional—Text

The Path and Redirection Actions ​

set_path — Set Path

FieldStatusPanel labelValue
newPathRequiredNew path infoText
--condOptionalAction conditionA condition expression
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText

set_pathq — Set Path + Query

FieldStatusPanel labelValue
newPathRequiredNew path infoText
--condOptionalAction conditionA condition expression
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText

normalize_uri — URL Normalization

FieldStatusPanel labelValue
--condOptionalAction conditionA condition expression
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText
--normalizationOptions.NOptionalNormalizationMore than one is selected from the list, default ['percent-decode-unreserved']

req_redirect_location — Location Redirection

FieldStatusPanel labelValue
redirectLocRequiredRedirect locationText
--condOptionalAction conditionA condition expression
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText
--redirectCodeOptionalRedirect code9 options (300 · 301 · 302 …), default 300

redirect_scheme — Redirect to HTTPS

FieldStatusPanel labelValue
--condOptionalAction conditionA condition expression
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText
--redirectSchemeCodeOptionalRedirect scheme code9 options (300 · 301 · 302 …), default 300

error_redirect_at_tm — Redirect for Traffic Manager Errors

FieldStatusPanel labelValue
redirectLocRequiredRedirect locationText
--errorCodesOptionalError codes67 options (400 · 401 · 402 …), default 400

error_redirect_at_res — Redirect for Backend Service Errors

FieldStatusPanel labelValue
redirectLocRequiredRedirect locationText
--errorCodesOptionalError codes67 options (400 · 401 · 402 …), default 400

The Content Showing Actions ​

showContent — Show Content

FieldStatusPanel labelValue
--condOptionalAction conditionA condition expression
--ruleLocOptionalExecution levelatRequest · atResponse, default atRequest
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText
--contentProfileOptionalContent pageSelected from the list, default builtin_denied_en
--statusCodeOptionalStatus code84 options (200 · 201 · 202 …), default 200

error_file_at_tm — Show Content for Traffic Manager Errors

FieldStatusPanel labelValue
--contentProfileOptionalContent pageSelected from the list, default builtin_denied_en
--statusCodeOptionalStatus code84 options (200 · 201 · 202 …), default 200
--errorCodesOptionalError codes67 options (400 · 401 · 402 …), default 400

error_file_at_res — Show Content for Backend Service Errors

FieldStatusPanel labelValue
--contentProfileOptionalContent pageSelected from the list, default builtin_denied_en
--statusCodeOptionalStatus code84 options (200 · 201 · 202 …), default 200
--errorCodesOptionalError codes67 options (400 · 401 · 402 …), default 400

The Blocking and Verification Actions ​

deny — Block

FieldStatusPanel labelValue
--condOptionalAction conditionA condition expression
--ruleLocOptionalExecution levelatRequest · atResponse, default atRequest
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText
--denyTypeOptionalDeny typeSelected from the list, default deny
--denyStatusCodeOptionalDeny status code84 options (200 · 201 · 202 …), default 403

quarantine_table — Quarantine

FieldStatusPanel labelValue
--condOptionalAction conditionA condition expression
--ruleLocOptionalExecution levelatRequest · atResponse, default atRequest
--ruleProOptionalRule protocolhttp · tcp, default http
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText

advancedCaptcha — Advanced CAPTCHA

FieldStatusPanel labelValue
--condOptionalAction conditionA condition expression
--captchaTypeOptionalCaptcha Typetext · math · invisible, default text
--captchaDifficultyOptionalDifficulty1 · 2 · 3 · 4 · 5, default 3
--captchaLanguageOptional—en · tr
--captchaTitleOptionalTab TitleText
--captchaThemeOptionalThemeauto · light · dark, default auto
--captchaVerifiedTtl.valOptionalVerification Duration ValueA number (at least 0), default 24
--captchaVerifiedTtl.unitOptionalVerification Duration unitSelected from the list, default h
--captchaSizeOptionalSizesmall · medium · large, default medium
--captchaBgColorOptionalBackground ColorText
--captchaTextColorOptionalText ColorText

The fields that appear in the completion list but do not become active

The five fields below appear in the Tab list; their conditions are bound to the type field having the value captchaRule and, since this value is not in the action type set, the fields do not become active in any type.

FieldWhat it doesWhat is written after it
--captchaTimesIt is the field that determines how many times the verification will be asked forIt does not become active in this version
--blacklistTimeout.val · --blacklistTimeout.unitThey are the fields that determine how long the source taken into the blacklist will stay in the listIt does not become active in this version
--whitelistTimeout.val · --whitelistTimeout.unitThey are the fields that determine how long the source taken into the whitelist will stay in the listIt does not become active in this version

req_auth — User Authentication on HTTP Request

FieldStatusPanel labelValue
--condOptionalAction conditionA condition expression
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText
--realmOptionalRealmText, default Restricted

The Traffic Management Actions ​

bandwidthRule — Bandwidth Limitation

FieldStatusPanel labelValue
--condOptionalAction conditionA condition expression
--downloadLimitOptionalDownload limitA number (at least 1, at most 33554432)
--uploadLimitOptionalUpload limitA number (at least 1, at most 33554432)
--bwLimitTypeOptionalLimit typedynamic · stream, default static
--bandwidthKeys.NConditionalBandwidth group keysIt opens when --bwLimitType dynamic is written; the variables that determine the group

tcp_conn_mgmt — TCP Connection Management

FieldStatusPanel labelValue
--condOptionalAction conditionA condition expression
--ruleLocOptionalExecution levelatRequest · atResponse, default atRequest
--tcpActionOptionalActionSelected from the list, default reject

http-reuse — HTTP/TCP Multiplexing

FieldStatusPanel labelValue
--connectionModeOptionalConnection modekeep-alive · server-close · close, default keep-alive
--reuseCodeOptionalConnection share strategynever · safe · aggressive · always, default never

mirror — Traffic Mirroring

FieldStatusPanel labelValue
mirrorBackendRequiredMirror target serviceSelected from the list
--condOptionalAction conditionA condition expression
--mirrorSamplingOptionalSamplingtrue · false, default false
--mirrorMaxBodyOptionalMaximum body size (KB)A number (at least 1, at most 32768), default 256
--mirrorTimeout.valOptionalShadow response timeout ValueA number (at least 0), default 2
--mirrorTimeout.unitOptionalShadow response timeout unitSelected from the list, default s
--mirrorMaxInflightOptionalConcurrent copy limitA number (at least 1, at most 65535), default 500
--mirrorAddXffOptionalAdd X-Forwarded-For headertrue · false, default false
--mirrorScrubHeaders.NOptional—Text
--mirrorSampleConditionalSampling percentageIt opens when --mirrorSampling true is written; between 0 and 100, default 10
--mirrorSampleKeyConditionalSampling keyIt opens when --mirrorSampling true is written; according to which key the sampling will be done

The Inspection, Variable and Log Actions ​

set_variable — Create Traffic Variable

FieldStatusPanel labelValue
--condOptionalAction conditionA condition expression
--ruleLocOptionalExecution levelatRequest · atResponse, default atRequest
--ruleProOptionalRule protocolhttp · tcp, default http
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText
--varEntries.N.nameOptionalVariable name—
--varEntries.N.valueOptionalVariable valueText

advancedTrafficInspection — Advanced Traffic Inspection

FieldStatusPanel labelValue
trafficInspectionTagRequiredTraffic tagText
--condOptionalAction conditionA condition expression
--ruleLocOptionalExecution levelatRequest · atResponse, default atRequest
--ruleProOptionalRule protocolhttp · tcp, default http
--trafficKeys.NOptionalField to trackText
--trafficPeriod.valOptionalTracking period ValueA number (at least 0), default 1
--trafficPeriod.unitOptionalTracking period unitSelected from the list, default s
--trafficTableSizeOptionalMax. table sizeA number (at least 5, at most 1000000), default 10000

modifyResponse — Modify Response Content

FieldStatusPanel labelValue
matcherRequiredMask queryText
--condOptionalAction conditionA condition expression
--modifyTypeOptionalModify typemask · htmlTag · replace, default mask; the selected value opens the sub-fields
--matcherTypeOptionalQuery typeplain · regex, default plain
--omittedCharactersConditionalOmitted charactersIt opens while --modifyType mask; the characters that will not be masked
--maskCharConditionalMasking characterIt opens while --modifyType mask; default *
--maskOffsetConditionalMasking toleranceIt opens while --modifyType mask; a number (at least 0), default 1
--maskFromConditionalMin. occurrences for maskingIt opens while --modifyType mask; a number (at least 1), default 1
--tagNameConditionalHTML tagIt opens while --modifyType htmlTag: html · head · body · title
--tagModifyTypeConditionalTag modify typeIt opens while --modifyType htmlTag: append · prepend
--htmlContentConditionalHTML content to addIt opens while --modifyType htmlTag; the HTML content to be added
replacementConditionally requiredNew contentIt becomes required while --modifyType replace; the content to be written instead
--matcherCaseSensitiveConditionalCase sensitiveIt opens while --modifyType mask or replace and --matcherType regex

manualRule — Manual Action

FieldStatusPanel labelValue
manualRuleContentRequiredManual rule contentText
--ruleLocOptionalExecution levelatRequest · atResponse, default atRequest
--manualRuleTargetOptionalManual rule fieldglobal · defaults · frontend · defaultBackend · dynamicBackends, default global
--manualRulePriorityOptionalManual rule priorityA number

silentLog — Conditional Silent Log

FieldStatusPanel labelValue
--condOptionalAction conditionA condition expression
--ruleLocOptionalExecution levelatRequest · atResponse, default atRequest
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText

ipMask — IP Log Masking

FieldStatusPanel labelValue
--countHitsOptionalHit countertrue · false, default false
--setVarOnHitOptionalSet variable on hitText
--ipMaskCidrOptionalMasking(subnet)A number (at least 0, at most 128), default 24

ipFix — IPFIX Log Sending

FieldStatusPanel labelValue
--ipFixIpPort.ipOptional—Ip
--ipFixIpPort.portOptional—Port
--ipFixTypeOptionalSend typeenterprise · standard, default enterprise

prometheusService — Provide Prometheus Service

FieldStatusPanel labelValue
--condOptionalAction conditionA condition expression
--metricAddressOptionalMetric addressText, default /metrics

Examples ​

TR7 WEB-CLI · A) Adding a header and redirection
admin@TR7LBWAF01> lb action add type add_header name add-client-ip \
headerNameToAdd X-Client-IP headerContent <value>
admin@TR7LBWAF01> lb action add type req_redirect_location name redirect-old-address \
redirectLoc https://portal.kurum.com.tr/
admin@TR7LBWAF01>  
TR7 WEB-CLI · B) A type without an additional field
# the type and the name are enough, the behavior is set with the optional fields
admin@TR7LBWAF01> lb action add type redirect_scheme name redirect-https
admin@TR7LBWAF01> lb action add type deny name block
admin@TR7LBWAF01>  
TR7 WEB-CLI · C) Traffic mirroring and binding to a vService
admin@TR7LBWAF01> lb action add type mirror name test-mirror mirrorBackend <backend> \
--mirrorTimeout.val 3 --mirrorTimeout.unit s
admin@TR7LBWAF01> lb service update id <vService> --rules.0 <action>
admin@TR7LBWAF01>  

Updating and Deleting ​

TR7 WEB-CLI · update and delete
admin@TR7LBWAF01> lb action update id <id> --headerContent <new-value>
admin@TR7LBWAF01> lb action delete <id>
admin@TR7LBWAF01>  

Things to Know ​

  • An action does not work without being bound to a vService. The binding is done with lb service update id <vService> --rules.N <action> and is valid only in the vServices of the HTTP and TCP types.
  • It can be matched with a condition. In which traffic the action will be applied is determined with the lb condition records.
  • The type can be changed later. When the type is changed in an update, the required fields of the new type have to be given as well.
  • The duration fields are two parts. The timeout and duration fields are written in the form --field.val and --field.unit.
  • The field list opens together with the type. After the type is written, -- with Tab lists only the fields of that type; when ? is put at the end of the line, the explained table of the fields comes.