Forum Discussion

Matthew_Ross_71's avatar
Matthew_Ross_71
Icon for Nimbostratus rankNimbostratus
May 26, 2005

Capture a 4xx or 5xx status code...

All,

 

 

 

I am trying to catch a 404 or 401 or 500 http status code in my BIG-IP. I am having difficulty getting the rule to work. I started by using chapter 5, specifically pages 5-1 through 5-40 or so, to help out.

 

 

I found the http_header() function and thought that http_header("status") or http_header("status_code") and even http_header("statuscode") contains "404" would get what I wanted. This does not work.

 

 

I looked around some of these posts and saw a HTTP_Request type thing...I did not see this in my book.

 

 

I am running 4.5.10 build 84. Here is my current (non-working) rule:

 

 

if (http_header("status") == "404") {

 

redirect to "http://172.30.103.13:50123/customunavail.html"

 

}

 

else {

 

use pool myprodpool

 

}
  • Scott_Tennican_'s avatar
    Scott_Tennican_
    Historic F5 Account
    Sorry, V4.X iRules do not parse HTTP server responses. Note that table 5.4 is named "HTTP request string variables". You will have to upgrade to V9 to be able to create iRules based on the server response. However, you can redirect when the members of a pool go down. See Chapter 4 "Redirecting HTTP Requests" to read about it. If you aren't ready to move to V9, I would recommend upgrading to V4.5.13 to improve the reliability and security of your BIG-IP.
  • Gumby,

     

     

    Yea as I was digging around I did become aware of that. I had planned next weekend to upgrade to 4.5.12, then a couple of weeks after that go to 9.

     

     

    Thanks for your help...

     

     

    - Matt R.