0

With the below settings in web.xml I still don't see any caching going on in the headers:

curl -X HEAD -i http://localhost:8080/css/style-index.min.css?v=iris-7.23-

Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=782E2A12B148B7A53DBDD4B3C081EA33; Expires=Thu, 16-Mar-2017 17:04:34 GMT; Path=/; HttpOnly
Set-Cookie: ui=ac1b326b15ad76f38d6289; Expires=Fri, 16-Mar-2018 14:04:34 GMT; Path=/
X-FRAME-OPTIONS: SAMEORIGIN
Content-Type: text/css;charset=UTF-8
Content-Language: sv-SE-lensway
Content-Length: 5785
Vary: Accept-Encoding
Date: Thu, 16 Mar 2017 14:04:34 GMT
Connection: close


<filter>
    <filter-name>ExpiresFilter</filter-name>
    <filter-class>org.apache.catalina.filters.ExpiresFilter</filter-class>
    <init-param>
        <param-name>ExpiresByType image</param-name>
        <param-value>access plus 2 weeks</param-value>
    </init-param>
    <init-param>
        <param-name>ExpiresByType text/css</param-name>
        <param-value>access plus 2 weeks</param-value>
    </init-param>
    <init-param>
        <param-name>ExpiresByType application/javascript</param-name>
        <param-value>access plus 2 weeks</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>ExpiresFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
</filter-mapping>

[EDIT] Enabled logging, as suggested, and got the following in the log:

20-Mar-2017 10:28:35.382 FINE [http-nio-8080-exec-8] org.apache.catalina.filters.ExpiresFilter.getExpirationDate Use ExpiresConfiguration[startingPoint=ACCESS_TIME, duration=[30 DAY]] matching "text/javascript" for content-type "text/javascript;charset=UTF-8" returns 4/19/17 10:28 AM
20-Mar-2017 10:28:35.382 FINE [http-nio-8080-exec-8] org.apache.catalina.filters.ExpiresFilter.onBeforeWriteResponseBody Request "/js/1Q7231Qscripts-all.min.js" with response status "200" content-type "text/javascript;charset=UTF-8", set expiration date 4/19/17 10:28 AM

File is saved, server is restarted.

No change in the headers although the log says that the expiration date is set correctly: set expiration date 4/19/17 10:28 AM

What am I missing?

Thanks!

/J

jBoive
  • 1,219
  • 1
  • 14
  • 40
  • 1
    You can modify `conf/logging.properties` and set `org.apache.catalina.filters.ExpiresFilter.level = FINE`. Then check the log messages for troubleshooting. – Beck Yang Mar 17 '17 at 14:08
  • Added logging but don't get much wiser unfortunately. – jBoive Mar 20 '17 at 10:03

0 Answers0