CloudFlare has become one of my favorite tools for improving website performance. Whether I am writing firewall rules or making use of its worker’s tech it has become a necessity on any website I work on. This being said, arcade websites, in particular, are in need of its benefits particularly to help deliver game files.

Even on a solid server a lot of users hitting it all at once for various games can use a lot of bandwidth but also slow down to a crawl. You could go the traditional CDN route such as MaxCDN, or AWS but those are going to bill you on based on bandwidth. Which, if you’re a small website the cost can become a detriment to your business.

CloudFlare doesn’t charge you for bandwidth in fact, it’s free plan is a great fit for any website and as you grow the pro & business plans offer a lot of amazing functionality that you can make use of when the time comes. But, for now, the free plan is a great start and it can reduce the load time of your website and reduce server costs (and strain).

Introduction To Page Rules

Page Rules are an interesting feature in CloudFlare they allow you to cache the entire website (with some breakage unless you’re on the business plan), or enable/disable certain features on specific pages. For MyArcadePlugin users, you can make use of page rules to serve your games from the edge, increasing their download speed for users, while also reducing bandwidth and server costs for yourself.

What Should My Page Rule Look Like?

The page rule is going to change based on your domain but it should look something similar to the below picture. Go to the page rules section -> and for the URL matches section enter the following.

*yourdomainhere.com/wp-content/uploads*

The * at the beginning indicates that whether the site is accessible on http or https www or non-www to always run the rule. The second * indicates that anything in the /uploads/ folder or after it should also be included in this rule.

Now, beneath that URL section select “add a setting”. Search for cache level and then in the next box select “Cache Everything”. Then we need to add one more setting, add a setting and search for “edge cache TTL”. From there, select “a month” this means that CloudFlare will cache the game file up to a month at its edge meaning your server should receive as few hits as possible from users who are trying to play your game.

Wrapping It Up

After this, you’re now having your games served from the edge quickly, and with as little impact on your own server as possible.