trafficserver icon indicating copy to clipboard operation
trafficserver copied to clipboard

Fix HTTP caching compliance by adding Vary headers for compressible content

Open mlibbey opened this issue 1 month ago • 3 comments

The compress plugin was only adding Vary: Accept-Encoding headers when content was actually going to be compressed, not when content could be compressed. This can cause downstream caches to never get the compressed version in cache.

Now adds Vary: Accept-Encoding headers for all compressible content regardless of whether compression is applied, ensuring proper HTTP cache behavior.

mlibbey avatar Dec 09 '25 01:12 mlibbey

@JakeChampion because of big recent changes to compress.

mlibbey avatar Dec 09 '25 01:12 mlibbey

In case it's helpful: https://ci.trafficserver.apache.org/job/Github_Builds/job/centos/5791/console

../../../plugins/compress/compress.cc: In function 'void Compress::{anonymous}::handle_range_request(TSMBuffer, TSMLoc, const Compress::HostConfiguration*)':
../../../plugins/compress/compress.cc:100:35: error: passing 'const Compress::HostConfiguration' as 'this' argument discards qualifiers [-fpermissive]
  100 |     switch (hc->range_request_ctl()) {
      |                                   ^
In file included from ../../../plugins/compress/compress_common.h:41,
                 from ../../../plugins/compress/compress.cc:36:
../../../plugins/compress/configuration.h:94:3: note:   in call to 'Compress::RangeRequestCtrl Compress::HostConfiguration::range_request_ctl()'
   94 |   range_request_ctl()
      |   ^~~~~~~~~~~~~~~~~

bneradt avatar Dec 09 '25 04:12 bneradt

Sorry for the initial build failures -- it was building locally :( (The Rocky crash looks to be in a cache subsystem regression test). Think it really ready for review.

mlibbey avatar Dec 10 '25 17:12 mlibbey