Disable APM rewrite for specicfic URI and redirect to external website

Problem this snippet solves:

This will disable APM for a specific URI (HEX mangled APM URI) and redirect user to the original address of the website.

Code :

when HTTP_REQUEST { 
if { [HTTP::uri] contains "123456789012345678962789346$$/mycompany" } { 
ACCESS::disable 
HTTP::redirect "https://test.mycompany.com/mycompany" 
} 
}

Tested this on version:

11.5
Published Jun 07, 2016
Version 1.0
  • Hi Habib,

     

    Can you give details of your scenario and what doesn't work?

     

  • I have a VIP with access policy. I am using below irule and doesnt work.

     

    when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/" } { ACCESS::disable HTTP::redirect "https://[HTTP::host]/WorkFlowUI/Home.aspx" } }

     

    I want to disable APM and redirect. APM will need to enabled only when a specific uri is requested.

     

  • Hi,

    Here is a more generic version of this irule

    when HTTP_REQUEST {
        if {[scan [HTTP::uri] {/f5-w-%[^$]$$%s} encressource uri] > 1} {
            set ressource [binary format H* $encressource]
            switch -- [URI::host $ressource] {
                "www.google.com" -
                "www.youtube.com" -
                "test3.mycompany.com" {  
                    HTTP::respond 302 Location $ressource$uri 
                }
            }
        }
    }