Forum Discussion

Javi_Lora's avatar
Javi_Lora
Icon for Altostratus rankAltostratus
Jul 27, 2021

Redirect to a node with context

I'm trying to create a rule that when it comes with a context it redirects me directly to a node with another context.

 

Example:

 

when HTTP_REQUEST {

  if {([HTTP::uri] starts_with "/citapreviarrcc") } 

     {

node "xxxxxxxxxxx:8080/citaprevia"   

  }

 

But F5 tells me that it is not possible.

 

Is there a way to do it.

 

Thanks.

1 Reply

  • Hi Javi Lora,

    when HTTP_REQUEST {
    	if { [HTTP::uri] starts_with "/citapreviarrcc" } {
    		HTTP::uri "/citaprevia"
    		node 1.2.3.4 8080 
    	}
    }

    If you want to see changed uri in browser:

    when HTTP_REQUEST {
    	if { [HTTP::has_responded] } { return }
    	if { [HTTP::uri] starts_with "/citapreviarrcc" } {
    		HTTP::redirect "http(s)://[HTTP::host]/citaprevia"
    		return
    	}
    	elseif { [HTTP::uri] equals "/citaprevia" } {
    		node 1.2.3.4 8080
    	}
    }