iRule – Redirects

#Different Redirects ########################  302 Redirects ######################## when HTTP_REQUEST {     HTTP::redirect https://www.domain.com/ } ########################  301 Redirects ######################## when HTTP_REQUEST {     HTTP::respond Location 301 https://www.domain.com/ } ############################ IF-Conditional Redirect: ############################ # Matching a condition when HTTP_REQUEST {     if {[HTTP::host] eq “domain.com”} {        … “iRule – Redirects”

Read More

iRule – Persistence Across HTTP Method

when HTTP_REQUEST { set HOST [string tolower [HTTP::host]] #Persistence is enabled for specific domain if { $HOST equals “domain.com” }{ #Persistence for GET Request if { [HTTP::method] equals “GET” } { set SESSIONID [findstr [HTTP::uri] “uuid=” 5 20] set KEY [crc32 $HOST$SESSIONID] persist hash $KEY … “iRule – Persistence Across HTTP Method”

Read More

F5 iRule – Secure & HTTPOnly Cookie

The following iRule taken from devcentral.f5.com was utilized to insert the “Secure” tag to all the cookies within the Response Header. Note that some part of the iRule has been “deactivated” as this part involves adding the “HTTPOnly” cookie tag which isn’t required for this … “F5 iRule – Secure & HTTPOnly Cookie”

Read More

iRule – To iRule or Not to

TCL based iRule is a force-multiplier when it comes to Application Delivery Networking utilizing F5 devices. However, it is essential to understand the interaction of iRule with the normal application. As an F5 iRule administrator, it is essential to understand the responsibility of maintaining the … “iRule – To iRule or Not to”

Read More

iRule – Altering Header Information

This iRULE example will alter the incoming URI before passing the request to the servers: when HTTP_REQUEST { switch -glob [HTTP::uri] { /old_URI/* { HTTP::uri /new_URI[HTTP::uri] } } } In this case, for any incoming request that starts with the URI “/old_URI/” (http://domain.com/old_URI/), the “/old_URI/” will … “iRule – Altering Header Information”

Read More

iRULE – non-English Characters

The web browser will URL encode URI’s that contain special characters. For example, http://www.domain.com/été is encoded as follows: http://www.domain.com/%C3%A9t%C3%A9 when HTTP_REQUEST { set ENCODED_URI [ b64encode [HTTP::uri]]     switch [HTTP::host] { “domain.com” {           if { (($ENCODED_URI eq “LyVDMyVBOXQlQzMlQTk=”) or ($ENCODED_URI eq “L2ZyLyVDMyVBOXQlQzMlQTk=”)) } { pool … “iRULE – non-English Characters”

Read More