Forum Discussion
Kai_Wilke
Feb 15, 2016MVP
Hi Will,
you may try the snippet below. It uses a
UnsupportedBrowser=true
cookie to track/check if the user was already informed to update the browser. The warning message will reapper just every 86400 seconds (=1day)...
when HTTP_REQUEST
if { [HTTP::cookie value "UnsupportedBrowser"] eq "" } then {
switch -glob -- [string tolower [HTTP::header value "User-Agent"]] {
"chrome/40" - "msie 11.0" - "msie 10.0" - "msie 9.0" - "msie 8.0" - "msie 7.0" - "msie 6." {
HTTP::respond 200 content [ifile get "us_a_supported_browser_html"] "Set-Cookie" "Unsupported_Browser=true; HttpOnly; Max-Age=86400; Path=/"
log local0. "Client IP:[IP::client_addr] has been redirected with user agent :[HTTP::header value "User-Agent"]"
}
}
} else {
log local0. "Client IP:[IP::client_addr] has already been redirected with user agent :[HTTP::header value "User-Agent"]"
}
}
Note: You have to rework the
conditions. They are not valid and/or missing some wildcards (-glob User-Agent
) to match just a certain substring.*
Cheers, Kai