#2100 closed enhancement (duplicate)

Expires directive does not allow to add immutable variable to Cache-Control header

Reported by: selivan@… Owned by:
Priority: minor Milestone:
Component: nginx-core Version:
Keywords: Cc: selivan@…
uname -a:
nginx -V: nginx/1.18.0

Description

expires directive sets 2 headers at once: Expires and Cache-Control.

Cache-Control is set to 'max-age=NNN', and can not be changed: using add_header just produces 2 Cache-Control headers.

I suggest to add optional flag [no_add_cache_control], that will stop expires directive from adding Cache-Control header and allow configuration like this:

expires no_add_cache_control 1d;
add_header Cache-Control "public, max-age=86400, immutable";

Cache-Control header has more variables than just max-age, it would be nice to be able to change it while still using Expires header for user agents that do not respect Cache-Control.

For example, immutable flag is useful to stop browsers like Firefox and Safari from creating requests for cached resources, just to get 304 response.

Change History (1)

comment:1 by Maxim Dounin, 11 months ago

Resolution: duplicate
Status: newclosed

Duplicate of #1188.

Note: See TracTickets for help on using tickets.