Technical Forum
Ask questions. Discover Answers.
Showing results for 
Search instead for 
Did you mean: 

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.



    # 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>"






I wouldn't use iRules here. Just because you CAN doesn't mean you SHOULD. Take a look at the following:

This is great information on how to customize APM, including login error pages and resultant webtops post successfull login. Hope this helps!

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. 

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.


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.