Encited

Custom response headers

Custom response headers let you add caching headers to pages on your site. You pick a path pattern and the headers to send, and Encited adds them to every matching response.

Custom response headers are included on the Essential plan and higher. They apply when your domain is connected through DNS. If you use a middleware integration, set the headers in your own server or edge configuration.

Add a header rule#

  1. In your site, open Site settings.
  2. Under Cache & routing, open Custom response headers.
  3. Click Add header rule.
  4. Enter a path pattern, such as /assets/**, or /** for every page.
  5. Select a header and enter its value.
  6. To add more headers to the same rule, click Add Header.
  7. Click Save changes.

Example: cache images and fonts for a year, and tell shared caches to keep pages for an hour.

Path pattern Header Value
/assets/** Cache-Control public, max-age=31536000, immutable
/** CDN-Cache-Control max-age=3600

Allowed headers#

You can set these headers:

  • Cache-Control
  • CDN-Cache-Control
  • Surrogate-Control
  • Expires
  • Any header that starts with X-Custom-, such as X-Custom-Build or X-Custom-Region.

Other headers are not allowed. This keeps a rule from changing security, cookie, or redirect behavior on your site.

Limits#

  • 10 rules per site.
  • 5 headers per rule.
  • Header names up to 128 characters.
  • Header values up to 2,048 characters of printable ASCII text, on one line.

How rules apply#

  • Encited adds the headers to every response on a matching path. This includes the pages crawlers get and the pages people get.
  • If your site already sends a header with the same name, the value from your rule replaces it.
  • If a path matches more than one rule, Encited adds the headers from all of them. When two rules set the same header, the rule lower in the list wins.
  • Redirect rules and files you host in Encited, such as a managed sitemap.xml or robots.txt, do not get custom headers.

Path patterns use the same rules as ignored paths: * matches one segment, and ** matches the rest of the path and must be the last segment. See Ignored paths for the full rules.

Check that it works#

Request a matching page and look at the response headers:

curl -sI https://www.example.com/assets/logo.png

If a header is missing, check that the path matches the pattern and that you saved the rule.