Custom headers
Site-wide headers are included in all plans, while headers based on path matching are included in our paid plans. Contact support in order to set up a paid plan.
If you need control over the HTTP headers on your site, you can do so via a
_headers
file placed in the root of your public folder. This file should
contain a list of paths with a list of headers to include indented under that
path:
Example _headers
file:
*
Cache-Control: public, max-age=60, must-revalidate
X-Frame-Options: DENY
/iframe-page/
X-Frame-Options: SAMEORIGIN
/static/*
Cache-Control: public, max-age=3600
~/\.([a-f0-9]{6,8})(\.min)?\.(css|js)$/
Cache-Control: public, immutable
-
Default site-wide headers are set using
*
(all plans) -
Other paths are matched exactly, e.g.
/blog/post/
(depending on plan) -
Wildcards can be used as part of the path (depending on plan)
Use an asterisk (
*
) in the beginning and/or end of a path for wildcard matching. Wildcards can also be used to match a specific path segment. For instance, to match all images in the blog section, use/blog/*/images/*
. -
Regular expressions can be used to match paths (depending on plan)
To match paths using a regular expression, use the format
~/pattern/
. This can be used for very flexible path matching. For instance, in order to match minified files generated with Hugo, use\.([a-f0-9]{6,8})(\.min)?\.(css|js)$
.
Note that, for any given header value, the last matched occurence of that header is used.