<\/span><\/h2>\nThis simple iRule redirects any HTTP traffic without the prepending www to a www address.<\/p>\n
when HTTP_REQUEST {
\nif { [HTTP::host] starts_with “fir3net.com” } {
\nHTTP::redirect\u00a0https:\/\/www.fir3net.com[HTTP::uri]
\n}
\n}<\/p>\n
{loadposition content_lock}<\/p>\n
<\/span>HTTP Redirect<\/strong><\/span><\/h2>\nThis iRule will action a HTTP redirect response when a HTTP request URI contains the string ‘Secure’.<\/p>\n
when HTTP_REQUEST {
\nif { [HTTP::uri] contains “Secure” } {
\nHTTP::redirect https:\/\/[HTTP::host][HTTP::uri]
\n}
\n}<\/p>\n
<\/span>HTTP Redirect (using 2 Conditions)<\/strong><\/span><\/h2>\nThis iRule will action a HTTP redirect response when a HTTP request URI ends with the string ‘\/sendmesomewhereelse’ and the host header contains the domain ‘mydomain.com’.<\/p>\n
when HTTP_REQUEST {
\nif { ([HTTP::host] equals “mydomain.com”) and ([HTTP::uri] ends_with “\/sendmesomewhereelse”) } {
\nHTTP::redirect http:\/\/google.com
\n}
\n}<\/p>\n
<\/span>URI Pool Selection<\/strong><\/span><\/h2>\nThis iRule will distribute traffic to Pool2 when the HTTP Request URI ends with ‘txt’.<\/p>\n
when HTTP_REQUEST {
\nif {[HTTP::uri] ends_with “txt”} {
\npool Pool1
\n}
\nelse { pool Pool2 }
\n}<\/p>\n
<\/span>Switch<\/strong><\/span><\/h2>\nThis iRule will distrubte traffic to the nessecary pool based on the URL.<\/p>\n
when HTTP_REQUEST {
\nswitch -glob [HTTP::host] {
\nexample-url1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { pool POOL-172.16.1.35-80-1 }
\nexample-url2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { pool POOL-172.16.1.35-80-2 }
\nexample-url3\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { pool POOL-172.16.1.35-80-3 }
\nexample-url4\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { pool POOL-172.16.1.35-80-4
\npersist source_addr 255.255.255.248 1800 }
\nexample-url5\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { pool POOL-172.16.1.35-80-5
\npersist source_addr 255.255.255.248 1800 }
\nexample-url6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { pool POOL-172.16.1.35-80-7
\npersist source_addr 255.255.255.248 1800 }
\ndefault\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { pool POOL-172.16.1.35-80-8 }
\n}
\n}<\/p>\n
<\/span>SNAT<\/strong><\/span><\/h2>\nThis iRule will translate the source address for any traffic originating from any address defined within the data group net-group and destined for TCP port 8181.<\/p>\n
when CLIENT_ACCEPTED {
\nif { [TCP::local_port] == 8181 and [class match [IP::client_addr] equals net-group ] } {
\nsnat 192.168.1.131
\n}
\nelse {
\nforward
\n}
\n}<\/p>\n