Talking about CDN with work practice

advantages

(1) Cache resources
(2) hosting static resources to CDN can make access to resources accelerate
(3) Source websites reduce load , so they are less likely to be attacked by DDOS

.
principle

CDN server = caching + DNS load balancer
after accessing the resource for the first time, the data of the origin server will be cached in the CDN server. The next time users need to access the node, they will directly find the data in the cache node of CDN.
store the hot data on CDN before accessing the resource for the first time. This is called "resource preheating" to prevent the first access to the origin server to bear a large number of requests at one time. Otherwise, the origin server will probably hang up

.
use skills
1

use max-age for caching settings. The default settings are proxy server caching time and local caching time. If we don"t want the CDN server to cache for too long, we can use s-maxage to set it, which will overwrite the max-age. This can effectively avoid the generation of dirty data

2

if the static resources you host on CDN change frequently, don"t host them on CDN

3x-cache-lookup

if hit, upstream is included in the value, it does not hit

.
4md5 

excuse me: what the heck is this? we always use it in our projects, but we still don"t know what it is

.

-Thank you ezmo for the answer-

md5 

is the version number. Some of the
used to refresh the cache prevent malicious origin-pull. An agreement has been reached with CDN that each request CDN will carry some information back to the origin after MD5 encryption. In this way, even if the hacker sniffs the source IP, and parses the past directly, it cannot be used normally. (those who shoot the cloud again have this feature, you can check it out.)
some verify whether the request link has been changed.
has a sense of pure presence
, most of which are used to identify the cache

.
Cdn
Mar.29,2021

your question has been answered before, stamp this , in short, it is generally to prevent the link address of cdn from being manually constructed, thus reducing the chance that cdn will be maliciously created.

P.S.

The address constructed by the
cdn server is generally url+ 's own key, and then the md5 is encrypted and returned together in url, such as https://img.codeshelper.com/upload/img/2021/03/29/exfvr4s120c14051.png?v=234242342&md5=d63d0b4fabf9e99002d0e0641c4ddfce
, which is a secret key.
is used when the cdn server receives a request to verify the validity of the url, that is, take out the https://img.codeshelper.com/upload/img/2021/03/29/exfvr4s120c14051.png?v=234242342 + key string from url and encrypt it with md5. See if it is equal to the md5 signature in url, and the equality proves that the url request is legal, otherwise it is considered to be made up by the client itself.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b39795-2c17b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b39795-2c17b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?