Of course, you must first enable the reload_assist_ims on Function in CDN. in this way, no-cache is not used. this will convert no-cache to if-modified-since. so we write ProgramIt is better to control if-modified-since. note: In the cache system architecture, it is best to control the backend, so the best way is to manage the expiration by the program. well, I only use PHP to write one, and other programs are the same.
See my program below. It will expire in 5 minutes.
CopyCodeThe Code is as follows: <? PHP
$ Headers = apache_request_headers ();
$ Client_time = (isset ($ headers ['if-modified-since '])? Strtotime ($ headers ['if-modified-since ']): 0 );
$ Now = gmmktime ();
$ Now_list = gmmktime ()-60*5;
If ($ client_time <$ now and $ client_time> $ now_list ){
Header ('Last-modified: '. gmdate ('d, D m y h: I: s', $ client_time). 'gmt', true, 304 );
Exit (0 );
} Else {
Header ('Last-modified: '. gmdate ('d, D m y h: I: s', $ now). 'gmt', true, 200 );
}
?>