Cloudflare Docs
Support
Support
Visit Support on GitHub
Set theme to dark (⇧+D)

Troubleshooting surges or spikes in web traffic

​​ Overview

There are many ways to protect and prepare your domain to handle spikes in traffic. We recommend the following strategies detailed below:

  • use Cloudflare Page Rules to customize caching
  • contact your hosting provider to understand the limits of your hosting plan
  • use Cloudflare IP addresses to your advantage
  • ensure Cloudflare IPs are allowed

​​ Use Cloudflare Page Rules to customize caching

By default Cloudflare caches static content like images, CSS and JavaScript; however, you can extend Cloudflare caching to work with HTML by creating custom  Page Rules.

​​ Cache everything

1. Log in to your Cloudflare account

2. Go to Rules > Page Rules

3. Select Create Page Rule.

4.  For the url, enter either your entire website or a section of your site.

5. For Settings, select Cache Level and then Cache Everything. Cloudflare will now fully cache HTML at our Edge network, instead of making roundtrips to your origin web server.

6. To control how long Cloudflare caches resources, add another setting for Edge Cache TTL and select a time duration.

With the Cache Everything option enabled, Cloudflare will be serving your entire site, taking the load off of your server completely, making your site as fast as possible.

Cloudflare customers on the Business plan can use advanced caching techniques to cache static content on dynamic HTML sites to reduce load using the Bypass Cache on Cookie Page Rule option.

​​ Cache anonymous page views

Before a visitor adds something to their shopping cart, logs in, or adds a comment, their page views are anonymous. By caching these types of page visits, you decrease server load, even if your site is dynamic. You can find out more information in the introductory blog post:  Caching Anonymous Page Views

There are multiple tutorials available on how you can do this:


​​ Contact your hosting provider to understand the limits of your hosting plan

Cloudflare offsets most of the load to your website via caching and request filtering, but some traffic will still pass through to your host. Knowing the limits of your plan can help prevent a bottleneck from your host. 

Once you are aware of your plan limits, you can use a feature like  Rate Limiting to restrict how many times anyone user can make a request to your website.


​​ Use Cloudflare IP addresses to your advantage

Take action to prevent attacks to your site during peak season by configuring your firewall to only accept traffic from Cloudflare IP addresses during the holidays. If you only accept  Cloudflare IPs, you can prevent attackers from getting to your original IP address and knocking your site offline.

Another option would be to restore visitor IP addresses and add DenyAllButCloudFlare to your Apache configuration.


​​ Ensure Cloudflare IPs are allowed

Cloudflare operates as a reverse proxy to your site so all connections come from Cloudflare IPs, so restricting our IPs can cause issues for visitors trying to access your site. The list of Cloudflare IPs can be found here:  https://www.cloudflare.com/ips.


​​ What information do I need when submitting a support ticket?

Before the high traffic event occurs, you must  open a Support ticket and provide the information below.

For WAF/CDN customers

  • Traffic origin region
  • Traffic duration
  • Traffic window (UTC)
  • Traffic method
  • Bandwidth size or range
  • Target IPs/range/zones/hostnames/full URLs
  • Contact in case of emergency

****For Magic Transit and Spectrum customers

  • Traffic origin region
  • Traffic duration
  • Traffic window (UTC)
  • Traffic method
  • Bandwidth size or range
  • Target IPs/range/zones
  • Target Ports
  • Protocol
  • Max packet/bit rate
  • Contact in case of emergency