HTTP headers directives

expires directive

Sets expiration metadata for eligible responses. Default off; HTTP, server, location or if in location. Negative duration requests validation; positive or zero specifies freshness.

Formal Syntax & Structure

nginx syntaxnginx
expires [modified] time; | expires epoch | max | off;

Parameters & Attributes

NameTypeDescription
modifiedliteral modifierUse file modification time rather than current time; only for time form.
time_or_modesigned duration | @time | epoch | max | off | variableSet client freshness or stop rewriting freshness headers; does not set proxy cache lifetime.

Working Example

Example Snippetnginx
expires 5m;
Nginx Reference