Forum Discussion

SANEESHPV_13756's avatar
SANEESHPV_13756
Icon for Nimbostratus rankNimbostratus
Feb 05, 2014

Replace the F5 injected Script before sending the Response

F5 injects a CSPM script in the response when we have Page Load Time option in BIG-IP Analytics. The subject script was injected in the HEAD tag of the HTML response. We have some metadata in the HEAD tag which we need to be move on top of the f5_cspm script before the response is send to the client.

 

 

Can we use an iRule to do this if possible. You help is much appreciated.

 

2 Replies

  • not sure if this is usable. anyway, html content profile is introduced in 11.4. we can use it to prepend and remove html tag (i.e. add new html tag and delete the old one).

    e.g.

    root@(ve11-8)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual bar
    ltm virtual bar {
        destination 172.28.24.201:80
        ip-protocol tcp
        mask 255.255.255.255
        pool foo
        profiles {
            cspm { }
            http { }
            myhtml { }
            tcp { }
        }
        source 0.0.0.0/0
        source-address-translation {
            type automap
        }
        vs-index 2
    }
    root@(ve11-8)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm pool foo
    ltm pool foo {
        members {
            200.200.200.101:80 {
                address 200.200.200.101
            }
        }
    }
    root@(ve11-8)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm profile analytics cspm
    ltm profile analytics cspm {
        app-service none
        collect-page-load-time enabled
        defaults-from analytics
        description none
        notification-email-addresses none
        partition Common
        traffic-capture {
            capturing-for-cspm { }
        }
    }
    root@(ve11-8)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm profile html myhtml
    ltm profile html myhtml {
        app-service none
        content-detection enabled
        content-selection { text/html text/xhtml }
        defaults-from html
        description none
        rules {
            prepend_meta
            remove_meta
        }
    }
    root@(ve11-8)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm html-rule tag-prepend-html prepend_meta
    ltm html-rule tag-prepend-html prepend_meta {
        action {
            text " "
        }
        match {
            attribute-name id
            attribute-value f5_cspm
            tag-name script
        }
    }
    root@(ve11-8)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm html-rule tag-remove remove_meta
    ltm html-rule tag-remove remove_meta {
        match {
            attribute-name name
            attribute-value description
            tag-name meta
        }
    }
    
  • Hi Nitass,

     

    Thank you for the response. I think this what I am looking for.

     

    regards, Saneesh