Forum Discussion

Cindy_127211's avatar
Cindy_127211
Icon for Nimbostratus rankNimbostratus
Nov 10, 2006

URI change with

I am using the following iRule, which I put together based on other postings I saw in this forum. However, it is not working as expected. What am I doing wrong?

 

 

when HTTP_REQUEST {

 

log local0. "URL: [HTTP::uri]"

 

set uri [string tolower [HTTP::uri]]

 

if { $uri starts_with "/pls/portal/url/page" } {

 

HTTP::uri [string map -nocase {"/pls/portal/url/page" "/portal/page/portal"} $uri]

 

log local0. "Changed URL: [HTTP::uri]"

 

pool connectsbox1webcache

 

}

 

else {

 

pool connectsbox1webcache

 

}

 

}

 

 

The logging that I'm seeing when the rule finds the '/pls/portal/url/page' is:

 

 

Nov 10 08:45:44 tmm tmm[640]: Rule newConnect : URL: /pls/portal/url/page/home_page/home

 

 

Nov 10 08:45:44 tmm tmm[640]: Rule newConnect : Changed URL: /pls/portal/url/page/home_page/home

 

 

So, it looks like the rule is identifying what needs to be changed, but it isn't changing. Any help that can be provided would be 'greatly' appreciated.

 

 

Thanks!

2 Replies

  • I think the HTTP::uri value is being updated correctly, but the value dispalyed is cached. Try running a tcpdump on the vlan your node is on, or check the web server logs, and verify the value is changed as expected.

     

     

    Aaron
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Aaron's right on this one.

     

     

    This is something that's confused a few people when using iRules. The reason that you're not seeing an updated value when calling the variable again is indeed that the value has been cached. You're pulling info from the cache, rather than the updated info that you just set. This has to do with some performance enhancement tuning that's been done, and won't effect the result of the rule at all.

     

     

    If you want to log this result to ensure things are changing as you anticipated, I'd recommend setting a custom variable, updating that, and then using that for your logging.

     

     

    Colin