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 514269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:30:26+00:00 2026-05-13T07:30:26+00:00

I created a Servlet filter with the following code in doFilter: HttpServletResponse httpResponse =

  • 0

I created a Servlet filter with the following code in doFilter:

HttpServletResponse httpResponse = (HttpServletResponse)response;

httpResponse.setHeader("Cache-Control","no-cache");
httpResponse.setHeader("Pragma","no-cache");
httpResponse.setDateHeader("Expires", 0); 

chain.doFilter(request, response);

I want to make sure that nothing gets cached at the Client and every request (even the one’s from the Browser’s back button) are directed to the Server.

But, even after implementing the above filter, some pages are cached (accessible using browser’s back button).

And other pages that are not cached, show Web Page Expired error in Internet Explorer.

  • 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-13T07:30:26+00:00Added an answer on May 13, 2026 at 7:30 am

    To start, the complete set is:

    httpResponse.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
    httpResponse.setHeader("Pragma", "no-cache"); // HTTP 1.0.
    httpResponse.setDateHeader("Expires", 0); // Proxies.
    

    The no-store and must-revalidate are required to get it to work in under each Firefox.

    But, even after implementing the above filter, some pages are cached (accessible using browser’s back button).

    How did you test it? Those headers will actually prevent the browser from requesting the page from the browser cache instead of directly from the server. Best test is to have a Filter to listen on /* and add a debug statement in flavor of:

    HttpServletRequest httpRequest = (HttpServletRequest) request;
    String method = httpRequest.getMethod();
    String URI = httpRequest.getRequestURI();
    System.out.println(method + " request invoked on " + URI);
    

    This should print the actual requests.

    Also ensure that you don’t override the headers in the JSP page itself using the HTML <meta> tags.

    And other pages that are not cached, show Web Page Expired error in Internet Explorer.

    You can only get this if the non-cached request was POST request, not a GET request. The GET requests will simply be requested from server again instead of from the browser cache.

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

Sidebar

Ask A Question

Stats

  • Questions 491k
  • Answers 491k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is a design decision. At the analysis level you… May 16, 2026 at 10:06 am
  • Editorial Team
    Editorial Team added an answer As the error message says, variable-length arrays can't be initialised… May 16, 2026 at 10:06 am
  • Editorial Team
    Editorial Team added an answer I've faced the same problem going the other way: Java… May 16, 2026 at 10:06 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I created a GridView in code with a DataTable as its data source which
i created a datalayer using subsonic. however when i am selecting my data, i
I created a repository in my local machine: svnadmin create /home/me/Desktop/svn_test/trunk Then import myDir
Diagrams created with Microsoft SQL Server Management Studio have their default schema set to
I created one apps and successfully submitted into AppStore. Now my client wants to
I created a sample Silverlight Web project and I am getting 'Access is denied'
I created a simple .so library containing definition of a C++ class which should
I'm pretty sure I remember reading --but cannot find back the links anymore-- about
From the examples that I have read and from the documentation on MysqlConnectionPoolDataSource at
I have used spring framework 3 for my application. Everything is ok while developed

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.