Forum Discussion
patonbike
Cirrus
Aug 10, 2018SQL Monitor question / problem...
Is it possible to run a SQL query and depending on the result put a pool member up or down? The problem here is that the SQL query is not running against the pool member.
As Hamish said, the HTTP iRule should work okay on an HTTPS VS that has a client SSL profile enabled to decrypt the SSL. You can check whether to send an HTTP or HTTPS redirect based on whether the client used an SSL cipher. As Hamish suggested, this should avoid a browser warning about switching from HTTPS to HTTP.
when HTTP_REQUEST {
Hide the SSL:: command from the iRule parser
so the iRule can be used on a non-client SSL VS
set cipher_cmd "SSL::cipher version"
Check if the client used an SSL cipher and it's not "none"
if {not ([catch {eval $cipher_cmd} result]) && $result ne "none"}{
Client did use a cipher
set proto "https"
} else {
Client did not use a cipher
set proto "http"
}
}
when HTTP_RESPONSE {
Check the server response code
switch [HTTP::status] {
404 -
500 {
HTTP::redirect "$proto://polite_message.com/index.htm"
}
}
}
Aaron
Nice work, Rodrigo! It's been since 1996 since I've dealt directly with C on a consistent basis, so it was nice to revisit an old friend. It also led me to investigate why python (my personal fave) doesn't really have pointers, and this article on Real Python does a great job showing the differences between C and python architecture, why pointers aren't really necessary in python, and of course ways to simulate or engage with pointers if you really must.
- Rodrigo_AlbuqueFeb 21, 2020
Cirrocumulus
Yeah, C is the old school thing that never gets outdated. I liked the last bit about emulating pointers in Python. Thanks for sharing that, Jason!