Forum Discussion
stan_peachey_86
Cirrus
Mar 04, 2010iRule: problem modifying uri without a redirect
I'm attempting to do a simple uri modify without a redirect and nothing changes:
when HTTP_REQUEST {
if { ([HTTP::uri] starts_with "/aaa/bbb/CCC/") } {
HTTP::uri "/aaa/bbb/ZZZ/"
}
}
logs show that the uri is not being modified. what am I missing? Thanks
-stan
- JRahm
Admin
HTTP::uri is cached, so you won't see the change in the log unless you add another lower priority (higher number) event for the log statement. 500 is the default priority, so anything higher will show the changed uri in a log statement. If you check the tcpdump, it should meet your expectations on the wire. You could add this to your rule to verify in your local logs:when HTTP_REQUEST priority 550 { log local0. "Updated URI is [HTTP::uri]" }
- Thanks for the cache priority tip citizen. just to keep this post updated, here is an alternative iRule suggested by f5 for uri modification using variables for the rewrite:
- JRahm
Admin
While you can be assured the magic is happening without logging, there really isn't any validation in that example. If going this route, might as well not set the variable to conserve cycles. Also, more conservative to send one log statement.when HTTP_REQUEST { if { [HTTP::uri] starts_with "/test" } { HTTP::uri /index.html log local0. "Original URI: [HTTP::uri], New URI: /index.html" } }
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects