Forum Discussion
chin_15339
Nimbostratus
Apr 30, 2017help required in elseif statement not working as expected
when RULE_INIT {
set static::debug 1
}
when CLIENTSSL_CLIENTCERT {
Example Subject DN: /C=AU/ST=NSW/L=Syd/O=Your Organisation/OU=Your OU/CN=John Smith
set subject_dn [X509::subject [S...
Stanislas_Piro2
Cumulonimbus
Apr 30, 2017Hi,
if you redirect to
/vinit-A.html, redirect only / URI, else, the request to /vinit-A.html will be handle by the irule and will redirect to /vinit-A.html
and use
switch instead of if / elseif / elseif/ elseif
when RULE_INIT {
set static::debug 1
}
when CLIENTSSL_CLIENTCERT {
Example Subject DN: /C=AU/ST=NSW/L=Syd/O=Your Organisation/OU=Your OU/CN=John Smith
set subject_dn [X509::subject [SSL::cert 0]]
if { $subject_dn != "" }{
if { $static::debug }{ log "Client Certificate received: $subject_dn"}
}
}
when HTTP_REQUEST {
if { [HTTP::host] contains "192" && [HTTP::host] && [HTTP::host] equals "/" } {
switch -glob -- $subject_dn {
"*CN=Vinit-A*" {HTTP::redirect "/vinit-A.html"}
"*CN=Vinit-B*" {HTTP::redirect "/vinit-B.html"}
"*CN=Vinit-B*" {HTTP::redirect "/vinit-C.html"}
}
} elseif { [HTTP::host] contains "168" && [HTTP::host] equals "/" }{
if { $subject_dn eq "" } {HTTP::redirect "/Certmissing.html"}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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