Forum Discussion
BP_11400
Nimbostratus
Jun 06, 2011iRule auth http check
Hello! So we want to setup an iRule to hit an auth PHP script for every request, and based upon the return code either make the original request or drop them to a login page.
Psuedo code:
when http request{
if ( http.fetch(http://our.site/auth) == 200)
accept
else http redirect login.php
}
The only catch is to make sure the original request cookies get forwarded to the auth script.
I can't seem to find anything to make the http.fetch request. Any ideas would be greatly appreciated, thank you!
- The_Bhattman
Nimbostratus
Hi BP,when HTTP_REQUEST { if {[active_members AUTH_PHPCHECK_POOL] = 0 } { Log local0. "Redirect accepted because AUTH_PHPCHECK_POOL monitor failed" HTTP::redirect "http://[HTTP::host]/login.php" } }
when HTTP_RESPONSE { if { !([HTTP::status] == 200) } { HTTP::redirect "http://[HTTP::host]/login.php" } } This doesn't check the exact PHP script - it simply redirects you based on the website responding back with anything beyond a HTTP STATUS Code of 200.
- John_Alam_45640Historic F5 AccountSo there are two options, neither of which are for the novice.
- hoolio
Cirrostratus
Deb had a fairly in depth example of this in an HTTP::retry article here: - JRahm
Admin
"So there are two options, neither of which are for the novice. "
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