24-Jul-2023 14:11
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>"
}
}
24-Jul-2023 18:30
I wouldn't use iRules here. Just because you CAN doesn't mean you SHOULD. Take a look at the following:
https://techdocs.f5.com/en-us/bigip-15-0-0/big-ip-access-policy-manager-customization.html
This is great information on how to customize APM, including login error pages and resultant webtops post successfull login. Hope this helps!
25-Jul-2023 12:21
Thanks for the reply.
I have a webtop, business doesn't like it. The page is very basic, but also very specific to the format they want.
I looked at hosted content, maybe that's where I'll end up, but hoped and figured I could get this set now, then come back. I don't want to grant access to anything on the network, no time for ACLs or customizations.
25-Jul-2023 13:14
Lol. No time for ACLs or customizations. Business needs to accept that having things look 'pretty how they like' is both time and money. No easy bullet here.
29-Jul-2023 06:21
My soluiton was two virutal servers, one acts as a gateway with an APM poiicy and directs to the second virtual after success on the policy. The second uses iFiles; an html file and images, css file referenced in the html file.