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.0CodeCentral_194
Cirrostratus
Joined May 05, 2019
CodeCentral_194
Cirrostratus
Joined May 05, 2019
No CommentsBe the first to comment
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)