cancel
Showing results for 
Search instead for 
Did you mean: 

iRule: New request after get response

Max89
Nimbostratus
Nimbostratus

Can I check response after receiving answer and run another request? This is necessary to check if the user is blocked. If the user is not blocked, give his result from another enpoint.

Something like: 

Send POST request /method1

 

when HTTP_REQUEST { 
	if { [HTTP::uri] == "/method1" } 
	{
		pool checkblock 
	} 
}

when HTTP_RESPONSE {  if { [HTTP::status] != 401} {
    REWRITE /method1 ????

 

How to do it? Is this a typical task for f5?

1 REPLY 1

If your goal is to send them elsewhere on a 401 then you can redirect them to the alternate endpoint.

# Redirect on 401 avoiding a redirect loop
when HTTP_RESPONSE {
if { [HTTP::status] == 401 } {
if { [HTTP::uri] ne "/method1" } { HTTP::redirect "/method1"
    }
} }