Forum Discussion
Stanislas_Piro2
Aug 22, 2017Cumulonimbus
Hi,
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.