User Guide

http.expires
Plugin

expires allows you to set expiration header relative to the request time. It allows you to set different expiration durations base on a path matching a regular expression.

Full documentation

Examples

Syntax
expires { match regex duration }

match: a regular expression matching on path and an expiration duration.

Match subdirective can be repeated as many times as you want but only the first matching will be used.

Duration is a combination of 0y0m0d0h0i0s in that order. Parts can be omitted.

Expires various assets.
expires { match some/path/.*.css$ 1y # expires css files in some/path after one year match .js$ 1m # expires js files after 30 days match .png$ 1d # expires png files after one day match .jpg$ 1h # expires jpg files after one hour match .pdf$ 1i # expires pdf file after one minute match .txt$ 1s # expires txt files after one second match .html$ 5i30s # expires html files after 5 minutes 30 seconds }

You can specify as many match directives you need for fine-grained expiration control.

The first matching rule is used.

Related Links
Documentation

Access the full documentation for this plugin off-site:

Docs
Plugin Help

Get help from the maintainers of the http.expires plugin:

Support
Plugin Website

Visit http.expires's website for more information:

Website
Plugin Author: Hugues Lismonde
Last Updated: 30 Mar 2017, 1:06 PM
This plugin is independent of the Caddy project and is not endorsed or maintained by Caddy developers. Use at your own risk. Do not file issues for this plugin on Caddy's bug tracker.