What_Lies_Bene1
Oct 01, 2013Cirrostratus
Re: Regex rule conversion to iRule
Off in quite a few ways I'm afraid but nothing too bad. Here's my version, untested. I've never nested switch statements so it might not work, if not, there's lots of other ways to do it;
when HTTP_REQUEST {
switch [HTTP::method] {
"GET" -
"HEAD" -
"PROPFIND" -
"OPTIONS" {
switch [HTTP::header "Content-Type"] {
":application/x-www-form-urlencoded; charset = " -
":multipart/form-data;" -
":text/xml" {
log local0. "Request content type is not allowed by policy."
HTTP::respond 501 content "Request content type is not allowed by policy."
}
}
}
}
}