Teach mod_deflate [or a new module] how to do this stuff with a simple "PreCompressedFiles on" kind of flag and let it sort out the timing, Vary, etc. See https://bz.apache.org/bugzilla/show_bug.cgi?id=51336 for context