For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

SSHSSH_97332's avatar
SSHSSH_97332
Icon for Nimbostratus rankNimbostratus
Aug 07, 2014

HTTP Inserting at URI

Can some one help me with sample IRule that do the below : -Rewrite ( without redirect ) http://10.10.10.1:8090/abc to http://10.10.10.1:8090/XYZ/abc -Rewrite ( without redirect ) http://10.10.10.1:8090/abc/rts to http://10.10.10.1:8090/abc/XYZ/rts

 

2 Replies

  • Can some one help me with sample IRule that do the below :

     

    -Rewrite ( without redirect ) http://10.10.10.1:8090/abc to http://10.10.10.1:8090/XYZ/abc ... This inserted XYZ before abc -Rewrite ( without redirect ) http://10.10.10.1:8090/abc/rts to http://10.10.10.1:8090/abc/XYZ/rts ... This inserted XYZ after abc & before rts

     

  • e.g.

    // config
    
    root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual bar
    ltm virtual bar {
        destination 172.28.24.10:80
        ip-protocol tcp
        mask 255.255.255.255
        pool foo
        profiles {
            http { }
            tcp { }
        }
        rules {
            qux
        }
        source 0.0.0.0/0
        source-address-translation {
            type automap
        }
        vs-index 60
    }
    root@(ve11a)(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@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux
    ltm rule qux {
        when HTTP_REQUEST {
      switch -glob [HTTP::path] {
        "/abc/rts*" {
          HTTP::uri [string map {/abc/rts /abc/XYZ/rts} [HTTP::uri]]
        }
        "/abc*" {
          HTTP::uri [string map {/abc /XYZ/abc} [HTTP::uri]]
        }
        default {
           do something
        }
      }
    }
    }
    
    // test
    
    [root@ve11a:Active:In Sync] config  ssldump -Aed -nni 0.0 port 80
    New TCP connection 1: 172.28.24.1(53943) <-> 172.28.24.10(80)
    1407717427.4509 (0.0012)  C>S
    ---------------------------------------------------------------
    HEAD /abc/something 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
    Host: 172.28.24.10
    Accept: */*
    
    ---------------------------------------------------------------
    
    New TCP connection 2: 200.200.200.14(53943) <-> 200.200.200.101(80)
    1407717427.4526 (0.0013)  C>S
    ---------------------------------------------------------------
    HEAD /XYZ/abc/something 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
    Host: 172.28.24.10
    Accept: */*
    
    ---------------------------------------------------------------
    
    [root@ve11a:Active:In Sync] config  ssldump -Aed -nni 0.0 port 80
    New TCP connection 1: 172.28.24.1(53945) <-> 172.28.24.10(80)
    1407717439.3349 (0.0019)  C>S
    ---------------------------------------------------------------
    HEAD /abc/rts/something 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
    Host: 172.28.24.10
    Accept: */*
    
    ---------------------------------------------------------------
    
    New TCP connection 2: 200.200.200.14(53945) <-> 200.200.200.101(80)
    1407717439.3385 (0.0033)  C>S
    ---------------------------------------------------------------
    HEAD /abc/XYZ/rts/something 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
    Host: 172.28.24.10
    Accept: */*
    
    ---------------------------------------------------------------