Forum Discussion
john_mcgarrigle
Nimbostratus
Jan 10, 2008Detect browser JRE version?
I am completely new to F5 and iRules, so please excuse my lack of knowledge about what iRules are able to do. I am working on a project where the project manager would like for me to move traffic to different locations depending on a user's browser type and the Java plug-in it is using. I know that detecting the browser user_agent is fairly easy to do with iRules, but I have not found anything that indicates that the version of the Java plug-in can be determined.
Does anyone know if it is possible to determine Java plug-in version this with iRules? If it is possible, could you please point me to a resource that would show me how to do this? Thank you in advance for your help and patience with me.
- hoolio
Cirrostratus
I think the only time you'd see the JRE version number in any HTTP request headers is if the JVM actually makes the request. Browser user-agent strings don't normally include the JRE version number. If you look at your web server logs or other people's logs on the web, you don't typically see the JRE number. - hoolio
Cirrostratus
Actually, it looks like the client JRE downloads JAR files and includes the JRE version number in the User-Agent string:when HTTP_REQUEST { Log debug messages to /var/log/ltm? 1=yes, 0=no set java_version_debug 1 Check if the User-Agent header contains the string "java/" if {[string tolower [HTTP::header value User-Agent]] contains "java"}{ Parse out the Java version from "some text java/1.6.0 some text" to "1.6.0" switch -glob [string range [getfield [string tolower [HTTP::header value User-Agent]] "java/" 2] 0 4] { 1.6.* { Log a debug message to /var/log/ltm if {$java_version_debug}{log local0. "Matched 1.6.*"} Set the pool to the v1.6 pool pool java_1.6.x_pool } 1.5.* { if {$java_version_debug}{log local0. "Matched 1.5.*"} pool java_1.5.x_pool } 1.4.* { if {$java_version_debug}{log local0. "Matched 1.4.*"} pool java_1.4.x_pool } default { if {$java_version_debug}{log local0. "Matched default"} pool java_default_pool } } } }
when RULE_INIT { set user_agent "Mozilla/4.0 (Windows XP 5.1) Java/1.6.0_03 test" set user_agent [string tolower $user_agent] log local0. "\$user_agent: $user_agent" set java_version_string [getfield $user_agent "java/" 2] log local0. "\$java_version_string: $java_version_string" set java_version [string range $java_version_string 0 4] log local0. "\$java_version: $java_version" log local0. "Test: [string range [getfield [string tolower $user_agent] "java/" 2] 0 4]" }
- john_mcgarrigle
Nimbostratus
Aaron - - JRahm
Admin
Aaron is a genuine superhero around here. Aaron's contribution to this site is what community is all about! - Colin_Walker_12Historic F5 AccountYou've got that right! Thanks again for all the efforts Aaron, without users like you and citizen_elah, DevCentral wouldn't be anything near what it is today.
- hoolio
Cirrostratus
They're all fun little puzzles to figure out. And thanks to everyone else that posts for us to learn from.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects