Forum Discussion
forsan
Apr 29, 2014Altostratus
node select iRule
Hi,
I have created an iRule that that is supposed to send traffic to a specific node depending on input from the URI.
The iRule looks like this:
when HTTP_REQUEST {
set node_ip [getfield [H...
nitass
Apr 29, 2014Employee
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 {
qux
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 9
}
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
set node_ip [getfield [HTTP::uri] "/" 4]
log local0. "node_ip $node_ip"
if { $node_ip >= 160 and $node_ip <= 253 } {
HTTP::uri [string map [list $node_ip ""] [HTTP::uri]]
log local0. "HTTP::uri [string map [list $node_ip ""] [HTTP::uri]] "
log local0. "node 10.1.1.$node_ip 80"
} else {
log local0. "pool mediaroot-pool"
}
}
}
test
[root@ve11a:Active:In Sync] config curl -I http://example.com/foo/bar/mediaroot/image1.jpg
HTTP/1.1 404 Not Found
Date: Tue, 29 Apr 2014 12:37:51 GMT
Server: Apache/2.2.3 (CentOS)
Content-Type: text/html; charset=iso-8859-1
[root@ve11a:Active:In Sync] config tail /var/log/ltm
Apr 29 05:47:42 ve11a info tmm1[13022]: Rule /Common/qux : node_ip mediaroot
Apr 29 05:47:42 ve11a info tmm1[13022]: Rule /Common/qux : pool mediaroot-pool
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