Closed AutumnSun1996 closed 1 year ago
I have thought about it and I think it's better to remove SetAddVaryHeaderForCompression
and always set the Vary header. We also always set Content-Encoding. Can you change that, then I can merge it. Thanks.
Hi, the code is updated, please review again. Thanks.
See what you mean. But this leads to another question: should we also handle the case where the user has added 'Vary: Accept-Encoding'?
That's exactly what my example does.
oh sorry, I just missed the second check. going to update it now
I created such a function to check and update the Header, instead of copy-paste. any more comments?
// AddVaryBytes add value to the 'Vary' header if it's not included
func (h *ResponseHeader) AddVaryBytes(value []byte)
Thanks!
Add config
SetAddVaryHeaderForCompression
to enable 'Vary: Accept-Encoding' header when compression is used.Added a config variable
addVaryHeaderForCompress
to control this feature, with setterSetAddVaryHeaderForCompression
. To remain backward compatible, it's false by default. When enabled, 'Vary: Accept-Encoding' header will be added when compression is used.fix #1583