Forum Discussion
DaveC_21078
Altostratus
Aug 27, 2009How can I chab=nge the format of a URL?
I need to be able to search for a URL similar to
http://example.com/adserver/impression/pid=123/oid=860/rand=12345/?click=http://www.publisher.com/track/ad.aspx?click=1&test=2&imp=1
...
DaveC_21078
Altostratus
Aug 31, 2009This looks right, but it is still passing the original URI. I'm stumped.
when HTTP_REQUEST {
if { [HTTP::uri] contains "adserver/impression" }{
set found [scan [HTTP::uri] "/adserver/impression/pid=%d/oid=%d/rand=%d" pidnum oidnum randnum]
if { $found == 3 } {
log local0. "This is the URI = [HTTP::uri]"
log local0. "Pid = $pidnum, Oid = $oidnum, rand = $randnum"
set newuri [string map [subst {"adserver/impression/pid=$pidnum/oid=$oidnum/rand=$randnum/?click" "ad.imp?pid=$pidnum&oid=$oidnum&rand=$randnum/?pclk"}] [HTTP::uri]]
log local0. "New URI: $newuri";
HTTP::uri $newuri;
}
}
}
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