Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

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


0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER
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
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER
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
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER
Looks good to me. As for consulting, I'd suggest you take a look at our new iRules On Demand program.

http://www.f5.com/training_services/services/irulesondemand/
Click here


Just tell them Joe from DevCentral sent you

-Joe
0