Back-to-origin authentication and timestamp anti-hotlinking methods are commonly used to prevent hotlinking. Each has its own advantages and disadvantages. You need to choose the appropriate solution based on the actual situation.
Back-to-origin authentication is to encrypt and sign the request URL, allowing the server to decrypt and verify the request after receiving it to determine whether access to the resource is allowed. Its advantage is that it can effectively prevent hot links, because even if an unauthorized request knows the resource address, it cannot pass signature verification and therefore cannot access the resource. But its disadvantage is that it needs to be verified on the server side, which may bring certain performance pressure when the traffic is large.
Timestamp hotlink prevention adds a timestamp parameter to the request URL. If the timestamp is too different from the server's current time, it means that the request has expired and the server will reject the request. Compared with back-to-source authentication, its advantage is that it is simple and fast to implement, does not require additional encryption and decryption operations on requests, and has less impact on server performance. But its disadvantage is that it is easy to be cracked by attackers, because the timestamp can be obtained through multiple requests and then reversed to obtain the correct timestamp value.
Therefore, you need to consider comprehensively based on specific application scenarios and security requirements to choose an anti-hotlink solution that suits you. If you need higher security, you can use back-to-origin authentication; if the security requirements are not very high, you can use timestamp anti-leeching.