Forum Discussion
Stripping chromeframe from User-Agent
Gang,
The chromeframe information in Header Value User-Agent is messing up one of our new applications. I'd like to strip just that information from the User-Agent. I've got an iRule written as follows:
when HTTP_REQUEST {
set useragent [string tolower [HTTP::header value User-Agent]]
if {$useragent contains "chromeframe"} {
HTTP::header value User-Agent [string map -nocase {"chromeframe/26.0.1410.64;" ""} $useragent]
}
}
This particular rule is throwing an error in the log, even though my F5 is storing the iRule correctly:
Jul 17 12:04:28 slot1/tmm1 err tmm1[6850]: 01220001:3: TCL error: /Common/chromeframe_strip - Illegal argument. Please check required arguments and their respective types (line 1) invoked from within "HTTP::header value User-Agent [string map -nocase {"chromeframe/26.0.1410.64;" ""} $useragent]"
Any advice is appreciated.
Thanks.
Joe
3 Replies
- Kevin_Stewart
Employee
Two things:
1. You want to use HTTP::header replace User-Agent to replace the UA header.
2. Because you're using -nocase in the string map, you don't need to do the [string tolower ] first with a temporary variable. - Joe_Erchul_4263
Nimbostratus
Kevin,
That seemed to work mostly. Now, I'm seeing this in the logs:
Pre-rule:
Jul 17 13:48:17 slot1/tmm info tmm[6849]: Rule /Common/chromeframe_strip : Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; chromeframe/26.0.1410.64; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8; .NET CLR 1.1.4322)
Post-rule:
Jul 17 13:48:17 slot1/tmm info tmm[6849]: Rule /Common/chromeframe_strip : Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8; .NET CLR 1.1.4322)
Which clearly shows that the User-Agent is having the "chromeframe" information whacked. However, when I monitor via HTTPWatch, I'm still seeing the "chromeframe" information:
User-Agent
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; chromeframe/26.0.1410.64; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Here's the most current version of the iRule:
when HTTP_REQUEST {
set useragent [HTTP::header value User-Agent]
if {$useragent contains "chromeframe"} {
log local0. $useragent
HTTP::header replace User-Agent [string map -nocase {"chromeframe/26.0.1410.64;" ""} $useragent]
log local0. [HTTP::header User-Agent]
}
}
- Joe_Erchul_4263
Nimbostratus
Okay, disregard my most recent post. A capture on the server shows that the chromeframe information has been removed from User-Agent. It's just not being written back to the client on the response. Kevin, thanks for the help with this! Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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