Forum Discussion

JustCooLpOOLe's avatar
JustCooLpOOLe
Icon for Cirrocumulus rankCirrocumulus
May 12, 2022
Solved

iRule Not Firing after APM policy completes

Hi,

I'm struggling to understand what is going on here.  Basically, we have an iRule on a HTTPS virtual server that takes the URI and presents a corresponding iFile.  This works perfectly but when I apply an APM policy to the configuration, the iFile never gets displayed.  Without the APM policy, we use the HTTP_REQUEST event but we can't use that since it fires before the APM policy can be started.  If we use ACCESS_ACL_ALLOWED, then the APM policy works but no content is diplayed and we see ERR_CONNECTION_RESET.

I've logged everything and the session.server.landinguri has the correct value for the URI but no content.  We're using the following in the iRule:

 

set uri [ACCESS::session data get "session.server.landinguri"]
switch -glob $uri {
     "/mylandinguri.html" { HTTP::respond 200 content [ifile get "mainpage"] }
}

 

Not sure what other events I need to do this.  The APM policy is on the same virtual server as the iRule.  The APM policy only displays a messsage box that a user can accept so no AD Auth or any other objects being used.

Any help is greatly appreciated.

6 Replies

    • JustCooLpOOLe's avatar
      JustCooLpOOLe
      Icon for Cirrocumulus rankCirrocumulus

      Thanks JoshBecigneul !  That works for a single default page but if I add another line to the switch such as: 

      when ACCESS_ACL_ALLOWED {
           set uri "myuri"
      
           switch -glob $uri {
                 "myreport.hmtl" { ACCESS::repond 200 content {ifile get "reportMainPage"] }
                 "myotherreport.html" { ACCESS::respond 200 content {ifile get "newPage"] }
      }
      }

      These work fine individually but within the reportMainPage ifile, there is a link to move to the "newPage" ifile.  When I click on it, the main page continues to exist even though the URL is updated.

    • JustCooLpOOLe's avatar
      JustCooLpOOLe
      Icon for Cirrocumulus rankCirrocumulus

      Edit:  I was using the session.server.landinguri variable in the switch statement rather than [HTTP::uri].  ACCESS::respond did the trick!  Thanks!

      • JoshBecigneul's avatar
        JoshBecigneul
        Icon for MVP rankMVP

        Sounds good. session.server.landinguri only gets set one time during access policy execution, which can be good to override if you want to force the user to connect to a specific URL.