Forum Discussion

Srinath_K_S's avatar
Srinath_K_S
Icon for Altostratus rankAltostratus
Feb 16, 2020

Can we use HTTP::Respond commmand in ADAPT_REQUEST_RESULT event?

Can we use HTTP::Respond command in ADAPT_REQUEST_RESULT event?.

3 Replies

  • No - HTTP::Respond is invalid in that context.

     

    What is the problem you are trying to solve?

     

     

  • Thanks for your reply.This is for an virus scanning solution, where in irule based on the scan status code response from ICAP server we perform different actions. For an error code we are trying to respond with a sorry page using HTTP::respond 302.

     

    Please suggest if there is any alternative.

    • Simon_Blakely's avatar
      Simon_Blakely
      Icon for Employee rankEmployee

      In HTTP_RESPONSE_RELEASE you can examine the HTTP::status and change the response with an HTTP::respond

      when HTTP_RESPONSE_RELEASE {
        if {[HTTP::status] == 307} {
          HTTP::respond 403 content "<HTML><HEAD><TITLE>Access Denied</TITLE></HEAD><BODY>VIRUS FOUND.</BODY>\n 
        }
        
      }

      This irule changes the ICAP server response from a 307 Temporary Redirect to a 403 static error page.