HTTP Header Rules

July 18, 2014 by Alex Thompson

HTTP headers are an important tool for tuning performance and making sure your website displays correctly. Primoca now lets you set sophisticated rules for the most common headers right from the control panel.

Cache Control

Cache-Control is the most important header for working with a CDN. It tells the CDN what and how it can cache which is the key to performance of static web assets. Most scenarios only need the max-age property which instructs how long (in seconds) to cache before checking the origin again.

The control panel lets you enter the max age in seconds, minutes, hours, days or years so you don't have to think about how many seconds are in a day or year. The rule can be applied based on the URL path or HTTP content type. Some examples:

  • All your CSS files are in one folder - rule path starts with /mycssfolder/
  • All your CSS files have extension .css - rule path ends with .css
  • Your CSS files don't have file extensions - rule content type equals text/css

Content Type

Content-Type is another crucial header that tells the browser how to handle the HTTP response. If not set correctly the browser may save the file to disk or not render it correctly in the browser window. The most common file extensions (like .html) are defaulted to the correct content type by the Primoca runtime. The rule can be applied by URL path. Some examples:

  • Files with an uncommon extension - rule path ends with .ext123
  • Files with no extension that are not HTML - rule path starts with /specialpath

Easy Empowerment

Usually to have this level of control over HTTP headers in a traditional web hosting environment you would need root access and deep knowledge of [Apache, NGINX, IIS] or server runtimes. With Primoca we give you streamlined control through our web control panel that works great on desktop or mobile. As always, this is part of our commitment to bringing you the easiest and highest performance web hosting experience on the planet.

Tags: Static_Websites Performance