ANS Documentation

Improve This Doc
  • Cloud
  • Domains and DNS management
  • Backup and High Availability
  • eCommerce Stacks
  • Security
  • Email
  • Monitoring and usage management
  • Networking
    • Content Delivery Network
      • Introduction to CDN
      • Getting Started
      • Caching Rules
      • Managing the cache
    • Colocation
    • Firewalls
    • Classic Load Balancers
    • Load Balancers
    • Policy
    • How to set up a Multi-Protocol VPN Server using SoftEther
  • Operating systems
  • Webcelerator
  • MyUKFast
  • Home >
  • Networking >
  • Content Delivery Network >
  • Caching Rules

Caching Rules¶

Cache control rules define the amount of time a file should be cached within the CDN network after the file is requested by the first visitor. This visitor must wait for the content to be delivered through CDN by the origin web server, but CDN will cache the file for subsequent visitors in the same region for the time specified by the caching rules. The longer your files are cached on the CDN network, the more likely it is that they will be available to the next visitor. However, this also means that it will take longer for your content to update across the network when this content is changed.

Types of Cache Control¶

There are two types of cache control within CDN, “Respect Origin Cache Control Headers” and “Custom”

  • Respect Origin Cache Control Headers: cache control headers are a feature of HTTP/1.1 and they allow full control of the time each static file on your website will be cached. These headers must be applied to each file that you would like CDN to cache, unless the file is included in a custom rule (below).
    For guidance on setting cache control headers, view this guide.

  • Custom: custom rules will override a file’s cache control headers and add a general rule to the files of the specific MIME types you select. This enables the CDN to cache files that don’t have any cache control headers set.

Configuring Rules within MyUKFast¶

  • Login to MyUKFast and head to DDoSX in the Products and Services menu.

  • Find the domain you would like to configure and select it.

  • On the Configure page, select the CDN tab.

connect

On this page you can add “Global” and “Per URI” rules, “Global” rules apply to your entire domain and “Per URI” rules apply to a specified domain extension only.

CLI:

ans ddosx domain cdn rule list mydomain.example

Global Caching Rules¶

  • Within the CDN tab of DDoSX, select Add Rule for Entire Domain

connect

  • Select the MIME types that you want CDN to cache (hold Ctrl to select multiple for this rule).

  • Define the type of cache control (outlined above).

CLI:

ans ddosx domain cdn rule create mydomain.example --cache-control "Origin" --mime-type "font/*" --mime-type "text/javascript" --type "global" --uri "/"

connect

  • If selecting “Custom”, use the drop-down menus to define the amount of time the content should be cached for.

  • Select Add Rule to create this rule and repeat for all other rules.

  • Once complete, select Apply Changes and your rules will be made active.

CLI:

ans ddosx domain cdn rule create mydomain.example --cache-control "Custom" --mime-type "font/*" --mime-type "text/javascript" --type "global" --uri "/" --cache-control-duration 3600s

URI Specific Caching Rules¶

Following the same process as when adding global caching rules but with control over the domain extension.

connect

For example, adding /static-content to the URI field will apply the rule to any content hosted within http://www.example.com/static-content

CLI:

ans ddosx domain cdn rule create mydomain.example --cache-control "Origin" --mime-type "font/*" --mime-type "text/javascript" --type "per-uri" --uri "/static-content"
ans ddosx domain cdn rule create mydomain.example --cache-control "Custom" --mime-type "font/*" --mime-type "text/javascript" --type "per-uri" --uri "/static-content" --cache-control-duration 3600s

Finally, click Apply Changes and your Cache rules will now be set up on the UKFast DDoSX® network, and configured appropriately. (You should allow up to 10 minutes for the changes to be fully applied)

CLI:

ans ddosx domain deploy mydomain.example

Next Article > Managing the cache

  • Useful Links
  • SMB
  • Enterprise
  • Channel
  • Public Sector
  • ANS Data Centres
  • About ANS
  • Careers
  • Blog
  • Get in touch
  •  
  • Sales 0800 458 4545
  • Support 0800 230 0032
  • Get in touch

© ANS Group Limited | Terms and Conditions | Corporate Guidance | Sitemap
ANS Group Limited, registered in England and Wales, company registration number 03176761, registered office 1 Archway, Birley Fields, Manchester M15 5QJ