The-messenger
Jul 24, 2023Cirrostratus
Need to format an iRule to display HTML content after successfully completed APM
Trying to help out a Dev team that wants to decom a web server. Currently the webserver displays a basic web page, this web servers sits as a node on an LTM Virtual Server with an APM policy. It all works fine but I figured it wouldn't be difficult to display a basic web page. But - it appears I'm not finding the correct context in the iRule. Help is appreciated!!
This is the rule I started with for testing.
when ACCESS_ACL_ALLOWED {
# Check if the APM policy evaluation was successful
if { [ACCESS::session data get "session.policy.result"] eq "allow" } {
# Set the HTTP response content type to "text/html"
HTTP::header replace "Content-Type" "text/html"
# Respond with the HTML content for successful APM policy evaluation
HTTP::respond 200 content "<html><body><h1>Welcome to the APM Protected Resource!</h1><p>This is a basic HTML content displayed after a successful APM policy evaluation.</p></body></html>"
}
else {
# Respond with the HTML content for denied access
HTTP::respond 403 content "<html><body><h1>Access is denied to this Resource!</h1><p>This is a basic HTML content displayed when access is denied by the APM policy.</p></body></html>"
}
}