Forum Discussion
Feb 24, 2015
Hi Bryce,
for testing you can go with this one:
when HTTP_REQUEST {
switch -regexp [string tolower [HTTP::path]] {
{\.gif$} { log local0. "[HTTP::path] matches <\.gif$>" }
{\.pdf$} { log local0. "[HTTP::path] matches <\.pdf$>" }
{\.txt$} { log local0. "[HTTP::path] matches <\.txt$>" }
{\.css$} { log local0. "[HTTP::path] matches <\.css$>" }
{\.swf$} { log local0. "[HTTP::path] matches <\.swf$" }
{\.flv$} { log local0. "[HTTP::path] matches <\.flv$>" }
{\.png$} { log local0. "[HTTP::path] matches <\.png$>" }
{\.ico$} { log local0. "[HTTP::path] matches <\.ico$>" }
{\.js$} { log local0. "[HTTP::path] matches <\.js$>" }
{\.js[^p]+.*$} { log local0. "[HTTP::path] matches <\.js[^p]+.*$>" }
{\.jpg$} { log local0. "[HTTP::path] matches <\.jpg$>" }
{\.ogv$} { log local0. "[HTTP::path] matches <\.ogv$>" }
{\.ttf.*$} { log local0. "[HTTP::path] matches <\.ttf.*$>" }
{\.mpv$} { log local0. "[HTTP::path] matches <\.mpv$>" }
{\.webm$} { log local0. "[HTTP::path] matches <\.webm$>" }
{\.*.m4v$} { log local0. "[HTTP::path] matches <\.*.m4v$>" }
{\.mp4$} { log local0. "[HTTP::path] matches <\.mp4$>" }
{\.xml$} { log local0. "[HTTP::path] matches <\.xml$>" }
default { log local0. "<[HTTP::path]> no match; using default pool" }
}
HTTP::respond 200 content "okay" Connection close
}
Due to the string tolower we can reduce the number of comparisons.
Maybe your app is working with the following one:
when HTTP_REQUEST {
switch -regexp [string tolower [HTTP::path]] {
{\.gif$} -
{\.pdf$} -
{\.txt$} -
{\.css$} -
{\.swf} -
{\.flv$} -
{\.png$} -
{\.ico$} -
{\.js$} -
{\.js[^p]+.*$} -
{\.jpg$} -
{\.ogv$} -
{\.ttf.*$} -
{\.mpv$} -
{\.webm$} -
{\.*.m4v$} -
{\.mp4$} -
{\.xml$} { pool preview_static_lb }
default { log local0. "<[HTTP::path]> no match; using default pool" }
}
}
I´m struggling with an expression '(?i)^(?!.*.jsp)..html?.$' from your httpclass.
It´s case insensitive with a negativ lookahead to match everything not containing ".jsp" and ending with "htm" or "html" followed by some single character, if I got it right.
Thanks, Stephan