In a distributed denial-of-service attack, a large volume of packets is sent to the victim server to prevent service delivery and make it unavailable to valid users and clients at the network edge. In this paper, we use content delivery networks to propose a new intelligent solution that protects the main servers at the network edge by using alternative edge servers and agents. Thus, Internet attacks on the main servers could be prevented. The simulation results show that, the proposed mechanism has considerably increased the processing efficiency at the edge servers, and simultaneously provided the required security against internet attacks.