iyaya

导航

通过响应头设置浏览器禁用缓存

固定设置浏览器不缓存(通常用于图片验证码响应)的响应头信息设置

response.setDateHeader("Expires", 0);
// Set standard HTTP/1.1 no-cache headers.
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
// Set IE extended HTTP/1.1 no-cache headers (use addHeader).
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
// Set standard HTTP/1.0 no-cache header.
response.setHeader("Pragma", "no-cache");
response.setContentType("image/jpeg");

posted on 2020-12-10 14:24  iyaya  阅读(546)  评论(0编辑  收藏  举报