If a resource (index.html) is already cached in the client, for example using response header:
"Cache-Control": "max-age=0, must-revalidate, proxy-revalidate"
How can I prevent tomcat to respond with a 304 Not Modified
in the next request to the server? I would like to force the server to respond with 200 instead of 304 no matter what.
I tried to set
httpResp.setHeader("Cache-Control", "no-cache, no-store, must-revalidate, proxy-revalidate");
httpResp.setHeader("Pragma", "no-cache");
httpResp.setHeader("Expires", "0");
but it only works in the SECOND request. The first request still gets 304.
I tried to override the if-modified-since
header using HttpServletRequestWrapper
with values in the past such as Mon, 06 Dec 2010 01:34:46 GMT
with no luck - client still gets 304 responses although the file was modified in 2015.
Is there any way I can prevent 304 responses? maybe via tomcat configuration?