A WAF differs from a traditional firewall in that it specifically protects web applications and websites from cyberattacks, while a traditional firewall focuses on network security.