Resolve an issue where HTTPS cannot be cached

Source: Internet
Author: User

Firefox deprecated HTTP, and instead vigorously promote the action of HTTPS a stone to arouse thousands of waves, many do not install security certificate of the Web site using the new version of Firefox has not been opened. Before our site only involved the need to encrypt the part of the connection as the HTTPS protocol, it seems to have to the entire site connection is installed HTTPS. The problem is that the function that was running normally is the same. In detail, the Product List page uses AJAX to load the product without caching the data that was loaded before. The reason for this situation is mainly two points, the 1th is the filter set in the background to force each page does not cache content, the second reason is because the entire site is encrypted, so that the browser itself will no longer page cache. The solution to this problem is to set the force cache on the page that needs to cache the data, as follows:

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" ><%@ page Language= "java" import= "java.util.*" pageencoding= "Utf-8"%><%@ taglib prefix= "C" uri= "http://java.sun.com/jsp /jstl/core "%><%@ taglib prefix=" FMT "uri=" http://java.sun.com/jsp/jstl/fmt "%><%@ taglib prefix=" FN "uri= "Http://java.sun.com/jsp/jstl/functions"%><%string path = Request.getcontextpath (), int nminutes = * 7;date D = new Date (); String moddate = d.togmtstring (); String expdate = Null;expdate = (new Date (D.gettime () + nminutes * 60000)). toGMTString (); Response.setheader (" Last-modified ", moddate); Response.setheader ("Expires", expdate); Response.setheader ("Pragma", "public"), Response.setheader ("Cache-control", "public");%>
In particular, note that the value of Cache-control and the value of pragma are "public".

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Resolve an issue where HTTPS cannot be cached

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.