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
| Name | Type | Description |
|---|---|---|
| modified | literal modifier | Use file modification time rather than current time; only for time form. |
| time_or_mode | signed duration | @time | epoch | max | off | variable | Set client freshness or stop rewriting freshness headers; does not set proxy cache lifetime. |
Working Example
Example Snippetnginx
expires 5m;