Forum Discussion

Romain_H_78910's avatar
Romain_H_78910
Icon for Nimbostratus rankNimbostratus
Nov 27, 2009

v10.0.1 - HTTP custom error pages through iRule

Hi there,

 

 

 

We are experiencing a problem with our custom error pages after upgrading our viprion chassis from 9.6 to 10.0.1.

 

 

 

here's the code:

 

 
 b class class_badrequest_page { type string filename "/var/class/badrequest.html" } 
  
 when HTTP_CLASS_FAILED { 
   HTTP::respond 400 content [lindex ${::class_badrequest_page} 0] "Content-Type" "text/html" 
 } 
 

 

 

 

It was working perfectly on the 9.6 version but not any more, it's returning a blank page with just "class_badrequest_page" instead of the content of the .html file.

 

 

We tried every syntax we could for the lindex without success.

 

It's impossible for us to implement directly the content of the .html file directly in our iRule because we have a lot of similar iRule.

 

 

 

Thanks in advance four your answers.

 

Romain.H

1 Reply

  • Hi Romain,

     

     

    In 10.x, you can no longer access classes directly as TCL lists. So instead of lindex, you can use the new class command (Click here):

     

     

    HTTP::respond 400 content [class element -value 0 class_badrequest_page] "Content-Type" "text/html"

     

     

    If you're using an external file you'll want to change the format to use := as the separator (replacing test with the actual html):

     

     

    cat /var/class/badrequest.html

     

    html := "test",

     

     

    The class page has an example of this.

     

     

    Aaron