Forum Discussion

adalan_1411's avatar
adalan_1411
Icon for Nimbostratus rankNimbostratus
Aug 17, 2009

HTTP Profile :: Vary Header Help

Not sure if this is the correct place for this, but I'm noticing what I would consider and abnormality in the way the VARY header is working. It seems to be adding a User-Agent component the vary header which I would like to remove:

 

With "vary header" checked under compression on HTTP profile:

 

----------------------------------------------------------

 

HTTP/1.x 200 OK

 

Date: Mon, 17 Aug 2009 13:06:39 GMT

 

Edge-control: !no-store

 

Content-Type: text/html

 

Expires: Tue, 18 Aug 2009 13:06:38 GMT

 

Cache-Control: max-age=86400,private

 

Vary: Accept-Encoding, User-Agent

 

Content-Encoding: gzip

 

Connection: close

 

----------------------------------------------------------

 

With "vary header" unchecked under compression on HTTP profile:

 

----------------------------------------------------------

 

HTTP/1.x 200 OK

 

Date: Mon, 17 Aug 2009 13:08:04 GMT

 

Edge-control: !no-store

 

Content-Type: text/html

 

Expires: Tue, 18 Aug 2009 13:08:04 GMT

 

Cache-Control: max-age=86400,private

 

Content-Encoding: gzip

 

Connection: close

 

----------------------------------------------------------

 

 

Is there a way to remove just the User-Agent portion?

 

5 Replies

  • I'm not too familiar with the Vary header and whether there is a good way to address this in the configuration. But if you want to remove everything including and after the first comma, you could use scan:

     

     

    scan everything not a comma into precomma and the rest into ignore

     

    scan [HTTP::header Vary] {%[^,]%s} precomma ignore

     

     

    Update the Vary header value with the scan output

     

    HTTP::header replace Vary $precomma

     

     

    Else, getfield would allow you to do this without the intermediate variables:

     

     

    Update the Vary header value with first field of the Vary header value, delimited by commas

     

    HTTP::header replace Vary [getfield [HTTP::header Vary] "," 1]

     

     

    Aaron
  • It seems like a lot of processing, I'd think there would be some setting to change the vary header that it's sending out. I just can't find it.
  • Vary headers allow you to change some element of a response (in this case, compression) based on a varying element of a request. Different browsers handle compression in different ways, so you typically want to vary on User-Agent to accommodate this. I believe that LTM has some built-in optimizations for compression if it is allowed to vary on User-Agent.

     

     

    I'm sure you have your reasons for wanting to remove this (and I can't think of anything at the moment to improve on Aaron's solution), but that's why it is there.

     

     

    Denny
  • sidiov's avatar
    sidiov
    Icon for Nimbostratus rankNimbostratus
    I want to resurrect this and ask if the OP ever got it working with just accept-encoding? I need this for our CDN network which only works with accept-encoding, and irules seem to have no effect on headers generated by the Load balancer, so I cant replace or insert new values.
  • spark_86682's avatar
    spark_86682
    Historic F5 Account
    If you need responses that the BIG-IP compresses to not Vary based on User-Agent, then you should disable the "browser workarounds" option in the compression profile, and make sure that compression to HTTP/1.0 clients is enabled.