Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-14005

Regression: ResourceHandlerRegistration setCachePeriod doesn't set the correct response header anymore

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 4.2.5
    • Fix Version/s: 4.2.6, 4.3 RC1
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      We have a Spring MVC application with Spring Security around it. In the MVC config we add resourceHandlers for static files together with cache periods. And Spring Security applies the default header configuration.

      @Configuration
      public class MvcConfig extends DelegatingWebMvcConfiguration {
      
          @Override
          protected void addResourceHandlers(ResourceHandlerRegistry registry) {
              registry.addResourceHandler("/images/**").addResourceLocations("/images/").setCachePeriod(60 * 60 * 8);
          }
      
      ...
      

      This has been working fine with Spring versions 4.2.1, 4.2.2, 4.2.3 and 4.2.4 combined with either Spring Security 4.0.2 or 4.0.4. The response contained the correct
      Cache-Control:max-age=28800
      header (and no Pragma header).

      But after upgrading Spring to 4.2.5 it doesn't work anymore. Now the response contains:
      Cache-Control:no-cache, no-store, max-age=0, must-revalidate
      Pragma:no-cache

      I also tried 4.2.6 and 4.3.0 BUILD-SNAPSHOTs, but the result was the same as with 4.2.5. There are a couple of issues related to Cache in 4.2.5 release notes, like SPR-13817 and SPR-13867, but I'm not sure if these are directly related.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bclozel Brian Clozel
              Reporter:
              zutnop Erko Hansar
              Last updater:
              Spring Issuemaster
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                1 year, 28 weeks, 6 days ago