Forum Discussion

stupid48's avatar
stupid48
Icon for Altocumulus rankAltocumulus
Jan 30, 2014

Newbie question on rewriting the URI and sending it to a pool node....

OK, so I've been reading articles on using iRules and did do a couple in the LTM GUI using "Deploying F5 with Oracle Fusion Middleware WebCenter 11gR1" as a sample. Now I'm trying to do a rewrite rule but I'm not sure how to start...

 

When a request comes into the virtual server (i.e. http://vserver/planning), I need to rewrite that URI to /clv/faces/home/planning and then send it on to one of the nodes in the LTM pool (i.e. webcenterpool).

 

Seems pretty straightforward but I just don't know how to begin. Thanks so much for any help...

 

Chris

 

5 Replies

  • What version are you running? This is baked into 11.4+ under local traffic, policies. When you setup a policy you can define what it looks for, what it replaces, and then where it sends the traffic in a rule.

     

  • You should also be able to do this is pre-11.4 with an http class profile. Either way, you shouldn't need to use an iRule for this. Let us know what version you are running and we can point you to the place where you can configure this.

     

    By the way, thanks for the question...it's good to see you participating on DevCentral!

     

    • stupid48's avatar
      stupid48
      Icon for Altocumulus rankAltocumulus
      I get the feeling that I should probably think about upgrading to the current release in any case. We do have a test environment so it might not be a bad idea.
  • just in case you want to try irule.

    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 {
            myrule
        }
        source 0.0.0.0/0
        source-address-translation {
            type automap
        }
        vs-index 2
    }
    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 myrule
    ltm rule myrule {
        when HTTP_REQUEST {
      if { [HTTP::uri] eq "/planning" } {
        HTTP::uri "/clv/faces/home/planning"
      }
    }
    }
    
     trace
    
    [root@ve11a:Active:In Sync] config  ssldump -Aed -nni 0.0 port 80
    New TCP connection 1: 172.28.24.1(37079) <-> 172.28.24.10(80)
    1391835914.4807 (0.0015)  C>S
    ---------------------------------------------------------------
    GET /planning 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: vserver
    
    ---------------------------------------------------------------
    
    New TCP connection 2: 200.200.200.14(37079) <-> 200.200.200.101(80)
    1391835914.4848 (0.0028)  C>S
    ---------------------------------------------------------------
    GET /clv/faces/home/planning 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: vserver
    
    ---------------------------------------------------------------