Forum Discussion

glen_unwin_1051's avatar
glen_unwin_1051
Icon for Nimbostratus rankNimbostratus
Nov 02, 2006

iRule re-direct

Hello

 

 

I wonder if you could help me please?

 

 

We are running a Big Ip 1500 version 9 for load balancing and SSL for our web site.

 

 

Could you possibly help me with the installation of an iRule which will will replace the old iRule (302 redirect) to a 301 redirect as follows:

 

 

 

 

OLD iRule (which gives a 302 redirect) :-

 

 

when HTTP_REQUEST {

 

 

if { [HTTP::host] contains "co.uk" } {

 

 

HTTP::redirect "Error! Hyperlink reference not valid."

 

 

}

 

 

}

 

 

 

 

 

 

 

 

NEW iRule :-

 

 

when HTTP_REQUEST {

 

 

if { [HTTP::host] contains "co.uk" } {

 

 

HTTP::respond 301 Location "Error! Hyperlink reference not valid."

 

 

}

 

 

}

 

 

 

 

 

 

Can you advise as to whether this rule is likely to cause us any issues please?

 

 

GlenUnwin@hastingsdirect.com

 

 

 

  • I honestly don't know how your OLD rule worked as you issues a redirect to an error string. The usage for HTTP::redirect is

     

     

    HTTP::redirect url

     

     

    You have the same issue for your HTTP::respond. The Location header takes a url, not a string.

     

     

    Otherwise it should work for you. Check out the wiki pages for HTTP::redirect and HTTP::respond for some examples.

     

     

    -Joe
  • Joe

     

     

    Thankyou for your helpful response, unfortunately as you pointed out there was an error with the iRule i pasted onto the site. The 302 redirect on the F5 including the url is as follows:

     

     

    OLD iRule (which gives a 302 redirect) :-

     

    when HTTP_REQUEST {

     

    if { [HTTP::host] contains "co.uk" } {

     

    HTTP::redirect "http://www.hastingsdirect.com[HTTP::uri]"

     

    }

     

    }

     

     

     

     

    NEW iRule :-

     

    when HTTP_REQUEST {

     

    if { [HTTP::host] contains "co.uk" } {

     

    HTTP::respond 301 Location "http://www.hastingsdirect.com[HTTP::uri]"

     

    }

     

    }

     

     

     

    Will the new iRule work.

     

    Also Joe, would you be available on a contract consultation basis to our company for future iRule upgrades on the F5s we have in place?

     

     

    Regards

     

    glen Unwin

     

    Hastings Direct

     

    Network Manager