For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Pool Based On Extension

Problem this snippet solves:

Requests for various image files go to one pool, pdf's to another, and everything else to a default pool. Example of using switch with a shared script body for multiple options. (The "-" means to execute the next script body if this condition matches.)

Code :

when HTTP_REQUEST {
  # Check the requested path (URI minus the query string)
  switch -glob [HTTP::path] {
    "*.jpg"-
    "*.gif"-
    "*.png"{ pool image_pool }
    "*.pdf"{ pool pdf_pool }
    default{ pool web_pool }
  }
}
Published Mar 18, 2015
Version 1.0
No CommentsBe the first to comment