Unable to clear cache

Modify the 2 pits brought by the system time.

1) tomcat does not update resource files.

Recently I need to do a small function with JS. Roughly, it is to obtain the time of the server, and then determine whether the time filled in by the user times out. Therefore, in order to test, it is necessary to change the system time frequently .

Then during the development process, it was found that the browser's "cache" (with double quotation marks, in fact, it is not the cause of the cache) could not be cleared by any means. Later, after analysis, it was the time of the system that was modified, so that the "cache" could not be cleared . tomcat is to judge the modification time to compile / or put the latest java / or resource files ). Below, restore the scene of the accident:

1. Modify the system time, the current correct time is September 19, 2017, we adjusted the system time to September 18;

It can be seen that the tomcat server is stored and not synchronized with the project file (eclipse has refreshed the resources).

 The server also shows that it has been synchronized. Even if publish, the following tomcat is still not updated.



 It can be concluded from the above that tomcat synchronizes the latest file by judging the modification time of the file. (At least the above phenomenon shows that)

2. Then let's look at the situation on the browser side.

First, the cache has been turned off. So the browser is refetching the js file from the server.


I added an alert in the js file. But no matter how you refresh. This alert cannot be displayed. 

The reason is that your file is not updated in tomcat.

This annoys me all morning. I don't know why the cache can't be cleared all the time. I thought it was the browser's cache. The result was that tomcat did not update the resources.

 

2) Can't request https resources in js

In js, if there is an https resource request, a secure https link cannot be established because you have modified the system time.

This is the https resource I am requesting in js.

 

After modifying the system time, the following error appears in the console:



 We can open the Baidu homepage to make this problem more obvious:



 
 

*tips: functions that involve time, try not to modify the system time when testing, you can directly pass in the time as a parameter (you can convert the required timestamp on this website ), instead of being lazy and modifying the system time directly, various kinds of things will happen question. The above is what I came across.
 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326485160&siteId=291194637