0

For security reason, using filter, I set the status code of every response to "302". Using code:

httpResponse.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);

==================================================

Monitoring with developer tool

  • Chrome and Firefox can display the pages successfully, with status =>"302 Moved Temporarily"
  • IE cannot display the page, with status => (Aborted)

I tried 301, 303, 307. None of them work. I tried 308, it works.

How can I solve the problem to display the page in IE with status code "302"?

Reference:

https://en.wikipedia.org/wiki/List_of_HTTP_status_codes

Reason: Marking the response "302", I tried to trick the browser to believe this is a redirect url, so that browser will not cache the input form data in last request.

  • Does your 302 response have a `Location` header? – dnault Apr 20 '16 at 20:08
  • @dnault No. If I want it works exactly like Chome and Firefox in IE, how should I set the header? – user3038497 Apr 20 '16 at 20:11
  • @dnault When a browser submits POST data in a form, it caches that data in memory and will resubmit the same data if I refresh the page. The browser only caches the data if the response from the server is "200 OK" or similar. The 302 redirect response makes the browser think the form was invalid and therefore it does not cache the POST data in memory – user3038497 Apr 20 '16 at 20:24
  • Is your situation the same as this? http://stackoverflow.com/questions/2699284/make-page-to-tell-browser-not-to-cache-preserve-input-values – dnault Apr 20 '16 at 20:37
  • @dnault yes, similar. But I want to do it in the filter way, instead of all the pages' form input field. – user3038497 Apr 20 '16 at 20:40

0 Answers0