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 509k
  • Answers 509k
  • 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 Unfortunately, data binding syntax (<%# %>) is not supported in… May 16, 2026 at 4:42 pm
  • Editorial Team
    Editorial Team added an answer :vimgrep /^\s*bool\s+\i+\s*=\s*(false)\|(true);\s*$/ [files....] ^ ^^^^ ^ You have some problems,… May 16, 2026 at 4:42 pm
  • Editorial Team
    Editorial Team added an answer If you don't want the behavior of DockPanel, don't use… May 16, 2026 at 4:42 pm

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'm getting the following error when I run a webservice client I've created using:
I have created an EAR with a web project, ejb3 project and the ejb
I want to create a Thread safe JSP page. It is possible in Servlet
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
I am stuck in a big problem with encoding in my website! I use
I needed to create an application using Struts2 as MVC,Hibernate for data access and
Ok so perhaps someone can help me with a problem I'm trying to solve.
I have run into an issue in which IE does not open up the

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.