Forum Discussion
OSAMUchan_32647
Nimbostratus
Aug 22, 2017I have a question about the notation of iRules (HTTP_RESPONSE)
Always thank you for your help.
I have a question about the notation of iRules.
There is iRules with HTTP_RESPONSE as below.
when HTTP_RESPONSE {
if {[HTTP::status] matches_glob {[4][0][...
Stanislas_Piro2
Cumulonimbus
Aug 22, 2017Hi,
During application development, you can use this irule :
when CLIENT_ACCEPTED {
set nodebug 1
}
when HTTP_REQUEST {
if {([HTTP::cookie value debug_mode] equals 1) || ([URI::query [HTTP::uri] debug_mode] equals 1)} {
set nodebug 0
}
}
when HTTP_RESPONSE {
if {$nodebug} {
switch -glob -- [HTTP::status] {
[4][0][1-9] -
[4][1-9][0-9] {
HTTP::redirect "https://naiyo.com/err/notfound.html";
}
[5][0-9][0-9] {
HTTP::redirect "https://naiyo.com/err/servererror.html";
}
}
} else {
HTTP::cookie insert name debug_mode value 1
}
}
the goal of this code is to use query parameter debug_mode=1 first time to allow debug mode.
then, a cookie is inserted in the response and next requests will be managed as debug.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects