**** HELP WITH IRULE FOR REDIRECTION*******
I have a requirement to diable redirects from API and Async calls within this part of my irule:
if { [HTTP::status] == "404" } {
set irule "Irule_Catch_404"
set http_status [HTTP::status]
set res_start_time [clock format [clock seconds] -format "%Y/%m/%d %H:%M:%S"]
set req_elapsed_time [expr {[clock clicks -milliseconds] - $tcp_start_time}]
if { [HTTP::header exists "Content-Length"] } {
set req_length [HTTP::header "Content-Length"]
} else {
set req_length 0
}
HSL::send $hsl "<190>,f5_irule=Splunk-iRule-HTTP,env=$env,src_ip=$client_address,vip=$vip,irule=$irule,http_method=$http_method,http_host=$http_host,http_port=$http_port,http_dest=$dest_url,http_uri=$http_uri,http_url=$http_url,http_version=$http_version,http_user_agent=\"$http_user_agent\",http_content_type=$http_content_type,http_referrer=\"$http_referrer\",req_start_time=$req_start_time,virtual_server=\"$virtual_server\",bytes_in=$req_length,res_start_time=$res_start_time,node=$node,node_port=$node_port,http_status=$http_status,req_elapsed_time=$req_elapsed_time,bytes_out=$res_length\r\n"
HTTP::redirect $pagenotfoundurl
set uri_rewritten 1
return
}
Can someone suggest an appropriate way to do this please? This is what I thought but I may be wrong!
[HTTP::status] starts_with "5" && {!{[HTTP::header] contains "Content-Type:application/json" || ![HTTP::header] contains "Content-Type:application/xml"}