Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Commit

Permalink
BZ61101: CORS filter should set Vary header in response. Submitted by…
Browse files Browse the repository at this point in the history
… Rick Riemer.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc8.0.x/trunk@1795815 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
rmaucher committed May 22, 2017
1 parent b14b0e9 commit f52c242
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions java/org/apache/catalina/filters/CorsFilter.java
Expand Up @@ -297,6 +297,10 @@ protected void handleSimpleCORS(final HttpServletRequest request,
exposedHeadersString);
}

// Indicate the response depends on the origin
response.addHeader(CorsFilter.REQUEST_HEADER_VARY,
CorsFilter.REQUEST_HEADER_ORIGIN);

// Forward the request down the filter chain.
filterChain.doFilter(request, response);
}
Expand Down Expand Up @@ -998,6 +1002,13 @@ public Collection<String> getAllowedHttpHeaders() {
"Access-Control-Allow-Headers";

// -------------------------------------------------- CORS Request Headers

/**
* The Vary header indicates allows disabling proxy caching by indicating
* the the response depends on the origin.
*/
public static final String REQUEST_HEADER_VARY = "Vary";

/**
* The Origin header indicates where the cross-origin request or preflight
* request originates from.
Expand Down
8 changes: 8 additions & 0 deletions webapps/docs/changelog.xml
Expand Up @@ -45,6 +45,14 @@
issues do not "pop up" wrt. others).
-->
<section name="Tomcat 8.0.45 (violetagg)" rtext="In development">
<subsection name="Catalina">
<changelog>
<fix>
<bug>61101</bug>: CORS filter should set Vary header in response.
Submitted by Rick Riemer. (remm)
</fix>
</changelog>
</subsection>
<subsection name="Coyote">
<changelog>
<fix>
Expand Down

0 comments on commit f52c242

Please sign in to comment.