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:08 UTC

[tomcat] branch main updated: Avoid unnecessary cache revalidation.

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

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


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

commit ba0c69d38d2e41ca4af9bb2aae12432062a88085
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 faf98cb..d751582 100644
--- a/java/org/apache/catalina/authenticator/AuthenticatorBase.java
+++ b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
@@ -552,10 +552,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 491caff..4e812c2 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -129,6 +129,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