Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7586695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:29:23+00:00 2026-05-30T19:29:23+00:00

Is it possible to apply different cache-control in the HTTP header response for specific

  • 0

Is it possible to apply different cache-control in the HTTP header response for specific files in a web app running on Tomcat? I’m looking to do so from the web app without having to change Tomcat’s configuration since those settings change with each deployment.

For instance, here’s an example of what I want:

  • Never Cache: /, /index.jsp (I understand that it’s possible to define caching in the header from the JSP or servlet class).
  • Cache: /js/, /img/, /css/* (cache these files for 3 months)

I appreciate your answers.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:29:24+00:00Added an answer on May 30, 2026 at 7:29 pm

    This is a definitely a job for ServletFilters as they allow you to intercept requests.

    This way you can easily set the correct HTTP Headers for caching

    I started writing a solution to this a few minutes ago using two ServletFilters.

    One filter to cache the resources and one not to cache them.

    However, I stumbled upon cache-filter and it already does the job for you…

    It looks like you need to point your Never cache resources to the

    NoCacheFilter

    And the cachable resources to the

    CacheFilter

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any possible way to apply more than CSS to a control through
Is it possible to have different classes for each simple_form so you can apply
I want to create a style which I can apply to different control types.
Possible Duplicate: How to apply the asp.net authorization in two different folders ? How
Is it possible to load multiple assemblies into a new AppDomain and apply different
Is it possible to apply / create a YUI Button by using an element's
Is it possible to apply a css(3) style to a label of a checked
Is it possible to apply (and remove) Windows group policy settings using .NET? I
Is it possible to apply reactive framework (Rx) in MVC application? or is it
Is it possible to apply trigger on any table in information_schema?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.