You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/07/27 14:19:38 UTC

[tomcat] branch 9.0.x updated: Avoid unnecessary cache revalidation.

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new bd75e4e  Avoid unnecessary cache revalidation.
bd75e4e is described below

commit bd75e4e643ab45706a0d831c962a2326ef4e47f5
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jul 27 15:17:44 2021 +0100

    Avoid unnecessary cache revalidation.
    
    Any cache that understands cache-control is not going to need to the
    expires header. Keep it in the securePagesWithPragma branch since that
    is for old HTTP/1.0 proxies that may not understand cache-control.
---
 java/org/apache/catalina/authenticator/AuthenticatorBase.java | 2 +-
 webapps/docs/changelog.xml                                    | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/authenticator/AuthenticatorBase.java b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
index 0e47bee..c46b0ba 100644
--- a/java/org/apache/catalina/authenticator/AuthenticatorBase.java
+++ b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
@@ -551,10 +551,10 @@ public abstract class AuthenticatorBase extends ValveBase
                 // Note: These can cause problems with downloading files with IE
                 response.setHeader("Pragma", "No-cache");
                 response.setHeader("Cache-Control", "no-cache");
+                response.setHeader("Expires", DATE_ONE);
             } else {
                 response.setHeader("Cache-Control", "private");
             }
-            response.setHeader("Expires", DATE_ONE);
         }
 
         if (constraints != null) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e8c0b21..1f9f910 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -123,6 +123,11 @@
         <bug>65443</bug>: Refactor the <code>CorsFilter</code> to make it easier
         to extend. (markt)
       </add>
+      <fix>
+        To avoid unnecessary cache revalidation, do not add an HTTP
+        <code>Expires</code> header when setting adding an HTTP header of
+        <code>CacheControl: private</code>. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org