responder-action¶
The following operations can be performed on "responder-action":
add| rm| set| unset| show| rename|
add responder action¶
Creates a responder action, which specifies how to respond to a request.
Synopsis¶
add responder action <name> <type> (<target> | <htmlpage>) [-comment <string>] [-responseStatusCode <positive_integer>] [-reasonPhrase <expression>] [-headers <name(value)> ...]
Arguments¶
name
Name for the responder action. Must begin with a letter, number, or the underscore character (_), and must contain only letters, numbers, and the hyphen (-), period (.) hash (#), space ( ), at (@), equals (=), colon (:), and underscore characters. Can be changed after the responder policy is added.
The following requirement applies only to the Citrix ADC CLI: If the name includes one or more spaces, enclose the name in double or single quotation marks (for example, "my responder action" or 'my responder action').
type
Type of responder action. Available settings function as follows: * respondwith <target> - Respond to the request with the expression specified as the target. * respondwithhtmlpage - Respond to the request with the uploaded HTML page object specified as the target. * redirect - Redirect the request to the URL specified as the target. * sqlresponse_ok - Send an SQL OK response. * sqlresponse_error - Send an SQL ERROR response.
Possible values: noop, respondwith, redirect, respondwithhtmlpage, sqlresponse_ok, sqlresponse_error
target
Expression specifying what to respond with. Typically a URL for redirect policies or a default-syntax expression. In addition to Citrix ADC default-syntax expressions that refer to information in the request, a stringbuilder expression can contain text and HTML, and simple escape codes that define new lines and paragraphs. Enclose each stringbuilder expression element (either a Citrix ADC default-syntax expression or a string) in double quotation marks. Use the plus (+) character to join the elements.
Examples: 1) Respondwith expression that sends an HTTP 1.1 200 OK response: "HTTP/1.1 200 OK\r\n\r\n"
2) Redirect expression that redirects user to the specified web host and appends the request URL to the redirect. "http://backupsite2.com" + HTTP.REQ.URL
3) Respondwith expression that sends an HTTP 1.1 404 Not Found response with the request URL included in the response: "HTTP/1.1 404 Not Found\r\n\r\n"+ "HTTP.REQ.URL.HTTP_URL_SAFE" + "does not exist on the web server."
The following requirement applies only to the Citrix ADC CLI: Enclose the entire expression in single quotation marks. (Citrix ADC expression elements should be included inside the single quotation marks for the entire expression, but do not need to be enclosed in double quotation marks.)
htmlpage
For respondwithhtmlpage policies, name of the HTML page object to use as the response. You must first import the page object.
comment
Comment. Any type of information about this responder action.
responseStatusCode
HTTP response status code, for example 200, 302, 404, etc. The default value for the redirect action type is 302 and for respondwithhtmlpage is 200 Minimum value: 100 Maximum value: 599
reasonPhrase
Expression specifying the reason phrase of the HTTP response. The reason phrase may be a string literal with quotes or a PI expression. For example: "Invalid URL: " + HTTP.REQ.URL
headers
One or more headers to insert into the HTTP response. Each header is specified as "name(expr)", where expr is an expression that is evaluated at runtime to provide the value for the named header. You can configure a maximum of eight headers for a responder action.
Example¶
1) add responder action act1 respondwith "\"HTTP/1.1 200 OK\r\n\r\n\"" 2) add responder action resp respondwithhtmlpage my-responder-page, 3) add responder action redir_action redirect '"http://backupsite2.com" + HTTP.REQ.URL'
rm responder action¶
Removes the specified responder action.
Synopsis¶
rm responder action <name>
Arguments¶
name
Name of the responder action to remove.
Example¶
rm responder action act_before
set responder action¶
Modifies the specified parameters of a responder action.
Synopsis¶
set responder action <name> [-target <expression>] [-htmlpage <string>] [-responseStatusCode <positive_integer>] [-reasonPhrase <expression>] [-comment <string>] [-headers <name(value)> ...]
Arguments¶
name
Name of the responder action to be modified.
target
Expression specifying what to respond with. Typically a URL for redirect policies or a default-syntax expression. In addition to Citrix ADC default-syntax expressions that refer to information in the request, a stringbuilder expression can contain text and HTML, and simple escape codes that define new lines and paragraphs. Enclose each stringbuilder expression element (either a Citrix ADC default-syntax expression or a string) in double quotation marks. Use the plus (+) character to join the elements.
Examples: 1) Respondwith expression that sends an HTTP 1.1 200 OK response: "HTTP/1.1 200 OK\r\n\r\n"
2) Redirect expression that redirects user to the specified web host and appends the request URL to the redirect. "http://backupsite2.com" + HTTP.REQ.URL
3) Respondwith expression that sends an HTTP 1.1 404 Not Found response with the request URL included in the response: "HTTP/1.1 404 Not Found\r\n\r\n"+ "HTTP.REQ.URL.HTTP_URL_SAFE" + "does not exist on the web server."
The following requirement applies only to the Citrix ADC CLI: Enclose the entire expression in single quotation marks. (Citrix ADC expression elements should be included inside the single quotation marks for the entire expression, but do not need to be enclosed in double quotation marks.)
htmlpage
For respondwithhtmlpage policies, name of the HTML page object to use as the response. You must first import the page object.
responseStatusCode
HTTP response status code, for example 200, 302, 404, etc. The default value for the redirect action type is 302 and for respondwithhtmlpage is 200 Minimum value: 100 Maximum value: 599
reasonPhrase
Expression specifying the reason phrase of the HTTP response. The reason phrase may be a string literal with quotes or a PI expression. For example: "Invalid URL: " + HTTP.REQ.URL
comment
Comment. Any type of information about this responder action.
headers
One or more headers to insert into the HTTP response. Each header is specified as "name(expr)", where expr is an expression that is evaluated at runtime to provide the value for the named header. You can configure a maximum of eight headers for a responder action.
Example¶
- set responder action act_responder -target 'HTTP.REQ.HEADER(MYURL) -redirectresponsecode <respcode>'/,
- set responder action act_responder -htmlpage my-local-file
unset responder action¶
Use this command to remove responder action settings.Refer to the set responder action command for meanings of the arguments.
Synopsis¶
unset responder action <name> [-responseStatusCode] [-reasonPhrase] [-comment] [-headers]
show responder action¶
Displays the current settings for the specified responder action. If no action name is provided, displays a list of all responder actions currently configured on the Citrix ADC, with abbreviated settings.
Synopsis¶
show responder action [<name>]
Arguments¶
name
Name of the responder action.
Output¶
stateflag
type
Type of responder action. It can be: (respondwith).
target
Expression specifying what to to respond with
htmlpage
Option specifying to respondwith htmlpage
bypassSafetyCheck
The safety check to allow unsafe expressions.
hits
The number of times the action has been taken.
referenceCount
The number of references to the action.
undefHits
The number of times the action resulted in UNDEF.
comment
Comment. Any type of information about this responder action.
builtin
Flag to determine whether responder action is built-in or not
feature
The feature to be checked while applying this config
responseStatusCode
HTTP response status code, for example 200, 302, 404, etc. The default value for the redirect action type is 302 and for respondwithhtmlpage is 200
reasonPhrase
Expression specifying the reason phrase of the HTTP response. The reason phrase may be a string literal with quotes or a PI expression. For example: "Invalid URL: " + HTTP.REQ.URL
headers
One or more headers to insert into the HTTP response. Each header is specified as "name(expr)", where expr is an expression that is evaluated at runtime to provide the value for the named header. You can configure a maximum of eight headers for a responder action.
devno
count
Example¶
- show responder action
- show responder action act_insert
rename responder action¶
Renames a responder action.
Synopsis¶
rename responder action <name>@ <newName>@
Arguments¶
name
Existing name of the responder action.
newName
New name for the responder action. Must begin with a letter, number, or the underscore character (_), and must contain only letters, numbers, and the hyphen (-), period (.) hash (#), space ( ), at (@), equals (=), colon (:), and underscore characters.
The following requirement applies only to the Citrix ADC CLI: If the name includes one or more spaces, enclose the name in double or single quotation marks (for example, "my responder action" or my responder action').
Example¶
rename responder action oldname newname