I would tend to say that the <If> code is correct and the RewriteCond code is wrong, because it doesn’t matter if the condition becomes true or false. The headers value has an influence on the result. Tricky question is what to do regarding Vary if the non-presence of a header has an influence.
Regards Rüdiger Von: Luca Toscano [mailto:[email protected]] Gesendet: Sonntag, 22. Oktober 2017 11:47 An: Apache HTTP Server Development List <[email protected]> Betreff: Re: mod_rewrite, vary headers and internal redirects Hi everybody, 2017-10-09 13:46 GMT+02:00 Luca Toscano <[email protected]<mailto:[email protected]>>: Hi Yann, 2017-10-08 14:13 GMT+02:00 Yann Ylavic <[email protected]<mailto:[email protected]>>: On Sun, Oct 8, 2017 at 2:03 PM, Yann Ylavic <[email protected]<mailto:[email protected]>> wrote: > Hi Luca, > > On Sun, Oct 8, 2017 at 11:59 AM, Luca Toscano > <[email protected]<mailto:[email protected]>> wrote: >> >> Does this approach make sense? Is there any smarter way to do it? > > I can't tell that I love the hack in internal redirects but looks like > a simple way to handle the case... > Nit: maybe a more descriptive name for the "keep-vary-header" note, > "redirect-keeps-vary"? +1 But after all, if we reach an internal redirect with some Vary header already set, maybe we should never drop it, thus internal redirects should preserve Vary in any case... I'd prefer to limit the scope of the httpd configurations affected by this change to the minimum, but the change would probably look less hacky :) After https://svn.apache.org/r1811744 trunk should be inline with what the docs say, but I have another question now: a RewriteCond condition (containing something like HTTP:someheader) adds a Vary header to the response only if the condition evaluates to true, meanwhile a <If> condition adds the Vary header regardless. Is there any good motivation for this difference or they should be modified to be more consistent? The <If> block behavior seems to be more sound (after reading https://tools.ietf.org/html/rfc7231#section-7.1.4), but I'd like to hear more expert opinions :) Thanks! Luca
