Description
Daniel Robert opened SPR-13805 and commented
The current implementation of DefaultCorsProcessor
contains this line:
responseHeaders.add(HttpHeaders.VARY, HttpHeaders.ORIGIN);
in the middle of handleInternal()
In the case where the wildcard domain is supported (CorsConfiguration.ALL
), this response header does not seem necessary. If all domains are supported, the response does not actually vary by requested domain/origin. Further, this implementation does not seem to provide any reasonably simple way to override this functionality.
An example of where this can become an issue is for pages being reverse proxied through a CDN that will not cache responses containing Vary headers (Akamai, for example, will deem a response uncacheable if the Vary header contains anything other than Accept-Encoding).
In the simplest case, this solves the problem:
if (!CorsConfiguration.ALL.equals(allowOrigin))
responseHeaders.add(HttpHeaders.VARY, HttpHeaders.ORIGIN);
Affects: 4.2.3, 4.2.4, 4.3 GA
0 votes, 5 watchers