How to set Expires HTTP header on a single JS file in Apache Tomcat?

前端 未结 2 1425
梦谈多话
梦谈多话 2020-12-14 14:06

I have a js file which is cached between 5-10 minutes, depending on whether I\'m using tomcat from the eclipse (via GWT plugin) or starting tomcat as standalone

2条回答
  •  难免孤独
    2020-12-14 14:35

    There is a Filter available in tomcat 7

    
    ExpiresFilter
    org.apache.catalina.filters.ExpiresFilter
    
    ExpiresByType image
    access plus 10 days
    
    
    
    ExpiresFilter
    /*
    REQUEST
    
    

    You can find more details here

    https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/filters/ExpiresFilter.html

提交回复
热议问题