Forum Discussion

Ashwini_6674's avatar
Ashwini_6674
Icon for Nimbostratus rankNimbostratus
Aug 08, 2012

iRule using Sideband

When a user clicks on a pdf (for example), how do I create 2 requests -

 

One that actually takes the user to that pdf

 

Second , route the request to a dummy (Cold Fusion) page that has some webtrends Code that tracks the hit to that PDF

 

 

Any help is appreciated

 

7 Replies

  • Hi Ashwini,

     

     

    You could use HTTP::retry for this or a sideband connection. Here are some related links:

     

     

    HTTP::retry

     

    https://devcentral.f5.com/wiki/iRules.http__retry.ashx

     

    https://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=105

     

     

    sideband connections

     

    https://devcentral.f5.com/wiki/iRules.sideband.ashx

     

    https://devcentral.f5.com/wiki/iRules.Sideband-connection-HTTP-example.ashx

     

     

    Aaron
  • Aaron,

     

    Can you provide me a simple example using http:retry. I'm trying to understand the concepts here.

     

     

    Thanks
  • There are three examples on the HTTP::retry wiki page:

     

     

    https://devcentral.f5.com/wiki/iRules.http__retry.ashx

     

     

    If you try testing an iRule and get stuck, reply here for more help.

     

     

    Aaron
  • Aaron,

     

    If possible , can you provide me an example specific to my question. I tried working off the examples you provided and it did not work.

     

    Any help is appreciated.

     

    Thanks

     

  • So far, I have only th eirule to redirect to my dummy link, which should not be visible to the user.

     

     

    I am having difficulty in creating a rule, so the user is directed to the pdf link that he clicked.

     

     

    if { [string tolower [HTTP::path]] ends_with ".pdf" }{

     

     

    HTTP::redirect "http://cmspublish.niehs.nih.gov/wt.cfm?fileurl=http://[http_host][http_uri]"

     

    }
  • e.g.

    root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm virtual bar
    ltm virtual bar {
        destination 172.28.19.252:80
        ip-protocol tcp
        mask 255.255.255.255
        pool foo
        profiles {
            http { }
            tcp { }
        }
        rules {
            myrule
        }
        snat automap
        vlans-disabled
    }
    root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm pool foo
    ltm pool foo {
        members {
            200.200.200.101:80 {
                address 200.200.200.101
            }
        }
    }
    root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm rule myrule
    ltm rule myrule {
        when HTTP_REQUEST {
       if {[string tolower [HTTP::path]] ends_with ".pdf"} {
          if {[catch {connect 200.200.200.102 80} conn_id] == 0 && $conn_id ne ""} {
                    set data "GET /wt.cfm?fileurl=http://[http_host][http_uri] HTTP/1.1\r\nHost: cmspublish.niehs.nih.gov\r\nConnection: Close\r\n\r\n"
                    send $conn_id $data
          }
       }
    }
    }
    
     connection 1 is from client to bigip
     connection 2 is sideband from bigip to 200.200.200.102:80
     connection 3 is from bigip to pool (foo)
    
    [root@ve11a:Active:Changes Pending] config  ssldump -Aed -nni 0.0 port 80
    New TCP connection 1: 172.28.19.251(36480) <-> 172.28.19.252(80)
    1349358406.9334 (0.0010)  C>S
    ---------------------------------------------------------------
    HEAD /dummy.pdf HTTP/1.1
    User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    Accept: */*
    Host: www.abc.com
    
    ---------------------------------------------------------------
    
    New TCP connection 2: 200.200.200.11(32170) <-> 200.200.200.102(80)
    1349358406.9357 (0.0010)  C>S
    ---------------------------------------------------------------
    GET /wt.cfm?fileurl=http://www.abc.com/dummy.pdf HTTP/1.1
    Host: cmspublish.niehs.nih.gov
    Connection: Close
    
    ---------------------------------------------------------------
    
    New TCP connection 3: 200.200.200.11(36480) <-> 200.200.200.101(80)
    1349358406.9368 (0.0010)  C>S
    ---------------------------------------------------------------
    HEAD /dummy.pdf HTTP/1.1
    User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    Accept: */*
    Host: www.abc.com
    
    ---------------------------------------------------------------