There is a company that offers a firewall service fir your web hosting, and it does this using the so-called 'cloud'. Furthermore, its starter package is free! The company is CloudFlare Inc.
So, what do you get? There is monitoring for 'junk' traffic ( eg, where a script kiddie is playing at DoSing your site). You benefit from (potentially) faster page loads because of the multiple cloudflare PoPs that service the requests with lower latency and basic caching.
What are the consequences of using this service? The obvious one is that cloudflare can see all of your traffic, so there are potential privacy issues combined with the value that they can extract from those requests. The performance of the service may not be up to scratch. You need to trust that they won't try to steal any of your traffic; even 1% could be worth a lot if they skim that off a lot of websites. You may have trouble with identifying visitors, as your web app will only see requests coming from cloudflare; code changes may be needed to make sure that member logins, analytics, log inspection tasks, etc, all continue to work.
To attempt to run your own service like cloudflare would take a lot of hardware, coding and administration, so for most people that's not a route worth exploring. On the other hand, be aware of what you're signing up to; be careful to weigh up speed, security and uptime against privacy, technical issues and trust.