Forum Discussion

Mark_Gallagher's avatar
Mark_Gallagher
Icon for Altocumulus rankAltocumulus
Feb 20, 2019
Solved

iRule to display static HTML 'sorry' page on empty pool not rendering on IE, Firefox - Chrome works

Good day all,

I am using a version of an iRule that I found here which is meant to display a static 'sorry' page when the pool members of a VIP reach 0. I put this in place but it came to my attention that it does not render at all from IE and firefox doesn't show an image. Chrome seems to work okay. I can't tell if I have some problem with the html I copied from another system here or if I am making a wrong assumption about how the static content can be displayed. Thanks if anyone has any ideas:

```

when LB_FAILED {
    if { [active_members [LB::server pool]] == 0 } {
        HTTP::respond 302 content {
Customer
 
 
 
 
 
  
  
    
       This service is currently unavailable. 
       We apologize for the inconvenience. 
      Please contact the Service Desk at 
      N-NNN-NNN-NNNN for further assistance
      
    
    
 
        }
}
}

```

  • UPDATE: Something (I don't know what) is keeping some of the images from rendering correctly in IE. changed it to a different image it works a treat with the below configuration (external image, 503, html inline in the irule).

    Thanks again for the assistance.

    Thanks all for the suggestions. I tried it as a 200 and am currently sending a 503 at the customer's request.

    when LB_FAILED {
        if { [active_members [LB::server pool]] == 0 } {
            HTTP::respond 503 content {
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
    <HTML xmlns="http://www.w3.org/1999/xhtml">
    	<HEAD>
    		<TITLE>
    			Customer
    		</TITLE>
    	<META http-equiv=Content-Type content="text/html; charset=utf-8">
    	<STYLE type=text/css>BODY {
    		FONT-SIZE: 15px; COLOR: #666; FONT-FAMILY: Arial, Helvetica, sans-serif
    	                            }
    	TD {
    		FONT-SIZE: 15px; COLOR: #666; FONT-FAMILY: Arial, Helvetica, sans-serif
    	    }
    	TH {
    		FONT-SIZE: 15px; COLOR: #666; FONT-FAMILY: Arial, Helvetica, sans-serif
    	    }
    	BODY    {
    		MARGIN: 30px 0px 0px; BACKGROUND-COLOR: #fff
    	        }
    	SPAN    {
      		FONT-WEIGHT: LIGHTER; FONT-SIZE: 120px; COLOR: #ccc; FONT-FAMILY: Arial, Helvetica, sans-serif
    	        }
    	</STYLE>
    	</HEAD>
    	<BODY>
    		<TABLE cellSpacing=0 cellPadding=0 align=center border=0>
      			<TBODY>
      				<TR>
        				<TD style="PADDING-RIGHT: 80px">
          				<p>This service is currently unavailable.</p>
          				<p>Please contact the Service Desk at<br>
          				1-800-123-4567 for further assistance</p>
          				</TD>
        				<TD>
    						<SPAN style="FLOAT: left" class="LARGELIGHT">
    							 (
    						</SPAN>
        				</TD>
        				<TD vAlign=center>
        					<SPAN style="FLOAT: right; VERTICAL-ALIGN: middle">
        						<IMG alt="Customer" src="https://www.customer.com/img/media-downloads/logo-customer-lores.jpg" width="400" height="100">
        					</SPAN>
        				</TD>
    				</TR>
    			</TBODY>
    		</TABLE>
    	</BODY>
    </HTML>
    }
    }
    }

    Still renders correctly on Chrome and Firefox, not on IE.

    Here's a how the html document looks - I realize that it may be better to put the image on the LTM as an ifile. It's as likely to be removed in the future as the external image is I suppose.

    < ifile not used >

4 Replies

  • Per the HTTP RFC 2616,

     

    **************

    302 Found

    "The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.

     

    The temporary URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s)."

    **************

     

    If you want to do a redirect, you should include the HTTP Location header in the response with the appropriate URI. I suspect some of the browsers, upon seeing the 302 status code, are requiring the Location header and, upon not finding it, won't continue with the response. If you do not want to do a redirect, use a 200 status code instead, as Jimmy L suggested.

  • Hey Mark,

     

    I've read in certain posts that 302 failed for IE, can you try 404 or something and see. I'm research for the exact answer & get back to you.

     

  • Mark,

    I was able to reproduce the problem with IE and the 302. But it displays it fine if I set it to 200 content, for example my test iRule:

     

    when HTTP_REQUEST {

      HTTP::respond 200 content {

         <html>

            <head>

               <title>LLAMAS!</title>

            </head>

            <body>

               <b>Dem llamas is great ain't dey?!</b>

            </body>

         </html>

      }

    }

     

    Is there a particular reason it needs to be a 302? It doesn't look like you're actually performing a redirect, just displaying a notice. If you just want the notice, I suggest changing the content type to 200.

  • UPDATE: Something (I don't know what) is keeping some of the images from rendering correctly in IE. changed it to a different image it works a treat with the below configuration (external image, 503, html inline in the irule).

    Thanks again for the assistance.

    Thanks all for the suggestions. I tried it as a 200 and am currently sending a 503 at the customer's request.

    when LB_FAILED {
        if { [active_members [LB::server pool]] == 0 } {
            HTTP::respond 503 content {
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
    <HTML xmlns="http://www.w3.org/1999/xhtml">
    	<HEAD>
    		<TITLE>
    			Customer
    		</TITLE>
    	<META http-equiv=Content-Type content="text/html; charset=utf-8">
    	<STYLE type=text/css>BODY {
    		FONT-SIZE: 15px; COLOR: #666; FONT-FAMILY: Arial, Helvetica, sans-serif
    	                            }
    	TD {
    		FONT-SIZE: 15px; COLOR: #666; FONT-FAMILY: Arial, Helvetica, sans-serif
    	    }
    	TH {
    		FONT-SIZE: 15px; COLOR: #666; FONT-FAMILY: Arial, Helvetica, sans-serif
    	    }
    	BODY    {
    		MARGIN: 30px 0px 0px; BACKGROUND-COLOR: #fff
    	        }
    	SPAN    {
      		FONT-WEIGHT: LIGHTER; FONT-SIZE: 120px; COLOR: #ccc; FONT-FAMILY: Arial, Helvetica, sans-serif
    	        }
    	</STYLE>
    	</HEAD>
    	<BODY>
    		<TABLE cellSpacing=0 cellPadding=0 align=center border=0>
      			<TBODY>
      				<TR>
        				<TD style="PADDING-RIGHT: 80px">
          				<p>This service is currently unavailable.</p>
          				<p>Please contact the Service Desk at<br>
          				1-800-123-4567 for further assistance</p>
          				</TD>
        				<TD>
    						<SPAN style="FLOAT: left" class="LARGELIGHT">
    							 (
    						</SPAN>
        				</TD>
        				<TD vAlign=center>
        					<SPAN style="FLOAT: right; VERTICAL-ALIGN: middle">
        						<IMG alt="Customer" src="https://www.customer.com/img/media-downloads/logo-customer-lores.jpg" width="400" height="100">
        					</SPAN>
        				</TD>
    				</TR>
    			</TBODY>
    		</TABLE>
    	</BODY>
    </HTML>
    }
    }
    }

    Still renders correctly on Chrome and Firefox, not on IE.

    Here's a how the html document looks - I realize that it may be better to put the image on the LTM as an ifile. It's as likely to be removed in the future as the external image is I suppose.

    < ifile not used >