URI redirection

Hello:

Can somebody validate the following iRule?

when HTTP_REQUEST {

if {[HTTP::uri] equals {http://www.abc.com/123}} {HTTP::uri {https://www.123.com/xyz}

}

}

I need to redirect a HTTP request to HTTPS.

Thanks,

Ijaz

Hi Ijaz,

If you want to redirect a client from http to https by sending them a 30x redirect, you can use an iRule like this:

when HTTP_REQUEST { 
  
     Check if host header and URI match 
    if {[string tolower [HTTP::host]] eq "www.abc.com" && [HTTP::path] starts_with "/123"}{ 
  
        Redirect client to new host and URI 
       HTTP::redirect "https://www.123.com/xyz" 
    } 
 }

If you want to send some requests to one pool via SSL and other requests to another pool without SSL, let me know and I can provide another example.

Aaron

Thanks Aaron.

Thanks for everything

Do you have a space in the name you’re trying to use for the iRule? You can’t use spaces in most LTM object names. Can you try redirect_alumno or something like that?

Aaron

The iRule looks correct to me, could you paste the entire log entry to show the source of the error?

Colin

Beaten to it by hoolio. :wink: I was thinking the same thing.

Colin