HTTP proxy directives
proxy_cache_valid directive
HTTP, server, location; no default rule. Sets fallback freshness by response status; upstream headers can override.
Formal Syntax & Structure
nginx syntaxnginx
proxy_cache_valid [code ...] time;Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| code | HTTP status or any (repeatable) | Select response statuses; omitted selects the default status set. |
| time | duration | Freshness fallback; origin cache policy can take precedence. |
Working Example
Example Snippetnginx
proxy_cache_valid 200 30s;