Forum Discussion

Brad_Otlin's avatar
Brad_Otlin
Icon for Employee rankEmployee
Nov 02, 2011

http::status 404 will NOT process http::respond 200

I have this iRule to check for 404s from the servers and reply to client with some simple html maint page. However, when a user requests a page that is not on the server, they just get the standard "IE cannot display the webpage". tcpdumps on internal BIGIP vlan show the server returning the 404. tcpdump on external bigip VLAN shows the client get, an ack from BIGIP to client but no response with either the 404 or the html in my irule. If I remove the iRule and attempt the same url with bad page request, the client gets standard 404 from server. For some reason BIGIP is not doing anything after evaluating for the status code 404. I've also tried doing an http::redirect to another site instead of http::respond and still nothing is returned by BIGIP. What am I missing>

 

 

See iRule code below:

 

 

when HTTP_RESPONSE {

 

 

if { [HTTP::status] == 404 } {

 

 

HTTP::respond 200 content "

 

 

Website

 

 

 

 

 

 

 

Site is Currently Unavailable

 

 

 

 

 

Site is experiencing a planned/unplanned outage, which is causing disruption for many users. We apologize for the inconvenience and are working to restore service. Please check back to receive the latest update.

 

 

 

 

Thank you.

 

 

 

 

IT

 

 

 

 

 

 

 

 

 

 

     

     

 

 

 

 

 

 

 

 

 

 

"

 

}

 

}

 

2 Replies

  • this is mine.

    [root@iris:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.17.33:http
       ip protocol tcp
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@iris:Active] config  b pool foo list
    pool foo {
       members 10.10.70.110:http {}
    }
    [root@iris:Active] config  b rule myrule list
    rule myrule {
       when HTTP_RESPONSE {
            if { [HTTP::status] == 404 } {
                    HTTP::respond 200 content "maintenance pageSite is Currently Unavailable"
            }
    }
    }
    
     curl -i http://172.28.17.33/notreal
    HTTP/1.0 200 OK
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 84
    
    maintenance pageSite is Currently Unavailable
    
    [root@iris:Active] config  ssldump -Aed -nni 0.0 port 80
    New TCP connection 1: 172.28.17.20(38858) <-> 172.28.17.33(80)
    1320255154.0773 (0.0011)  C>S
    ---------------------------------------------------------------
    GET /notreal HTTP/1.1
    User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    Host: 172.28.17.33
    Accept: */*
    
    ---------------------------------------------------------------
    
    New TCP connection 2: 10.10.72.30(38858) <-> 10.10.70.110(80)
    1320255154.0776 (0.0003)  C>S
    ---------------------------------------------------------------
    GET /notreal HTTP/1.1
    User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    Host: 172.28.17.33
    Accept: */*
    
    ---------------------------------------------------------------
    
    1320255154.0795 (0.0018)  S>C
    ---------------------------------------------------------------
    HTTP/1.1 404 Not Found
    Date: Wed, 02 Nov 2011 08:42:45 GMT
    Server: Apache/2.0.59 (rPath)
    Vary: Accept-Encoding
    Content-Length: 282
    Content-Type: text/html; charset=iso-8859-1
    
    
    
    404 Not Found
    
    Not Found
    The requested URL /notreal was not found on this server.
    
    Apache/2.0.59 (rPath) Server at 172.28.17.33 Port 80
    
    ---------------------------------------------------------------
    
    1320255154.0796 (0.0023)  S>C
    ---------------------------------------------------------------
    HTTP/1.0 200 OK
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 84
    
    maintenance pageSite is Currently Unavailable
    ---------------------------------------------------------------
    
    
  • I found my problem. This virtual server is also using the WAM. If I disable webaccel for this URL, then the splashpage is displayed when I get a 404.

     

     

    Found SOL11143 where it showed how to disable WAM before irule processing:

     

     

     

    WAM::disable

     

    HTTP::close

     

     

     

    Rock and Roll. It works now.