[rank_math_breadcrumb]

commonly used f5 irule

Posted by

Host and URL Rewrite, Content Matching and Redirecting

Below are some example iRules used for redirecting and rewriting URL and Host Headers.

Rewrites

Rewrite Hostname in HTTP Request

when HTTP_REQUEST {
    if { [HTTP::host] equals "domain.com" } {
        HTTP::header replace "Host" "newdomain.com"
    }
}

Rewrite URL in HTTP Request

when HTTP_REQUEST {
    if { [HTTP::uri] starts_with "/sometext" } {
        HTTP::uri "/newtext" 
    }
}


Rewrite Hostname in Response
 

when HTTP_RESPONSE {
    if { [HTTP::host] equals "domain.com" } {
        HTTP::header replace "Host" "newdomain.com"
    }
}


Redirects
 

Redirect based on URL used

when HTTP_REQUEST {
    if { [HTTP::uri] equals "domain.com" } {
        HTTP::redirect "http://www.newdomain.com/index.htm"
    }
} 

Redirect based on Hostname used

when HTTP_REQUEST {
    if { [HTTP::host] starts_with "/sometext" } {
        HTTP::redirect "http://www.newdomain.com/index.htm"
    }
}

[the-post-grid id=”9538″ title=””]

Leave a Reply

Your email address will not be published. Required fields are marked *

Visit Our Store and Buy All document (F5, Zscaler, ASA, Paloalto, Checkpoint,Forescout, Cisco ISE etc) only in  1600RS, click here on store - Store

X
error: Content is protected !!