Forum Discussion
Bryan_38092
Jun 09, 2015Nimbostratus
Create iRule to remove everything after a string found in the URI
Looking for some help, trying to create an iRule to remove everything including a string it finds in the URI. For example, http://www.foobar.com/data/12345=rank&format=XYZ and I want to remove the ...
- Jun 10, 2015
this is just another example.
configuration [root@ve11b:Active:In Sync] config tmsh list ltm rule qux ltm rule qux { when HTTP_REQUEST { set uri [HTTP::uri] if { $uri contains "format=XYZ" } { HTTP::uri [string map {"&format=XYZ" "" "format=XYZ&" "" "format=XYZ" ""} $uri] } log local0. "Before: $uri After: [HTTP::uri]" } } /var/log/ltm [root@ve11b:Active:In Sync] config tail -f /var/log/ltm Jun 10 22:03:00 ve11b info tmm[10343]: Rule /Common/qux : Before: /data/ After: /data/ Jun 10 22:03:09 ve11b info tmm[10343]: Rule /Common/qux : Before: /data/12345=rank&format=XYZ After: /data/12345=rank Jun 10 22:03:17 ve11b info tmm1[10343]: Rule /Common/qux : Before: /data/format=XYZ&12345=rank After: /data/12345=rank Jun 10 22:03:27 ve11b info tmm[10343]: Rule /Common/qux : Before: /data/test=abc&format=XYZ&12345=rank After: /data/test=abc&12345=rank
nitass_89166
Noctilucent
this is just another example.
configuration
[root@ve11b:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
set uri [HTTP::uri]
if { $uri contains "format=XYZ" } {
HTTP::uri [string map {"&format=XYZ" "" "format=XYZ&" "" "format=XYZ" ""} $uri]
}
log local0. "Before: $uri After: [HTTP::uri]"
}
}
/var/log/ltm
[root@ve11b:Active:In Sync] config tail -f /var/log/ltm
Jun 10 22:03:00 ve11b info tmm[10343]: Rule /Common/qux : Before: /data/ After: /data/
Jun 10 22:03:09 ve11b info tmm[10343]: Rule /Common/qux : Before: /data/12345=rank&format=XYZ After: /data/12345=rank
Jun 10 22:03:17 ve11b info tmm1[10343]: Rule /Common/qux : Before: /data/format=XYZ&12345=rank After: /data/12345=rank
Jun 10 22:03:27 ve11b info tmm[10343]: Rule /Common/qux : Before: /data/test=abc&format=XYZ&12345=rank After: /data/test=abc&12345=rank
Bryan_38092
Jun 10, 2015Nimbostratus
Thanks!
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