Forum Discussion

andrew_deackes_'s avatar
andrew_deackes_
Icon for Nimbostratus rankNimbostratus
Nov 26, 2009

Substitue user-agent header

Hi,

 

 

I'm sure someone has probably covered this before but I couldn't find anything quite relevant so here goes.

 

 

With some very specific users who are running IE 8 on Vista or Windows 7 and have various other applications installed the user-agent header is exceeding 256 characters. This is causing errors with the web servers not delivering the requested content. So, with an i-Rule how would I replace the clients user-agent header with one of less than 256 characters?

 

 

Thanks

 

 

A

3 Replies

  • Hi Andrew,

    You can use an iRule like this to check the User-Agent string length and truncate any that are over 256 characters.

     
     when HTTP_REQUEST { 
      
         Check the length of the User-Agent header 
        if {[string length [HTTP::header User-Agent]] > 256}{ 
      
            Replace the User-Agent header value with the first 256 characters 
           HTTP::header replace User-Agent [string range [HTTP::header User-Agent] 0 255] 
        } 
     } 
     

    Aaron
  • Also, if this is a matter of running IE7 compatibility mode for those that use IE8 then you can take a look at the following sample

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/Emulate_IE7_header_insertion_in_response_for_IE8.html

     

     

     

    Bhattman
  • Also, if this is a matter of running IE7 compatibility mode for those that use IE8 then you can take a look at the following sample

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/Emulate_IE7_header_insertion_in_response_for_IE8.html

     

     

     

    Bhattman