Irule Redirection for different host
Hi,
I need to write down an irule which states if traffic come for CN:abc.com it should redirect "def.com" and for CN tuv.com traffice goes to xyz.com.
Current Irule on LB:
This iRule:
- Checks the CN provided by the client SSL cert
when CLIENTSSL_CLIENTCERT {
Check if client provided a cert if {[SSL::cert 0] eq ""}{ Reset the connection reject } else { Check if the client certificate contains the correct CN log "Client Certificate: [X509::subject [SSL::cert 0]]" if { ([class match [X509::subject [SSL::cert 0]] contains F5_cn_list]) } { } else { log "No Matching Client Certificate Was Found Using: [X509::subject [SSL::cert 0]]" reject } } }
F5_cn_list :Contains CN abc.com and tuv.com
This CN will check in below Irule
irule to alter the host header for outbound traffic so that def.com is presented to the remote server
when HTTP_REQUEST { HTTP::header replace Host def.com log local0. "rewrite executed [HTTP::header "Host"]" }