This is the enhanced version of nginx's http_headers module. A new 'expires_by_types' directive is brought in to allow setting the expiration times according to different MIME types.
Syntax: expires_by_types [[modified] time | @time-of-day | epoch | max | off] content-type1 [content-type2] ...
Context: http, server, location
Specify an expiration time according to some MIME types.
The format of an expiration time is the same as nginx's 'expires'. You can add one or more MIME types after the time parameter.
Note if there are both 'expires' and 'expires_by_types' directives being set:
- If they are in the same block level, the exactly matched MIME type and its expiration time of 'expires_by_type' will be preferred. Otherwise, the expiration time of 'expires' will be honored.* If 'expires' and 'expires_by_types' are not set, the expiration setting will be inherited from the parent level.
- If 'expires off' is specified in the current level, all of the 'expires' and 'expires_by_types' settings will be turned off.
- If 'expires off' is specified in the parent level but not the current block, the setting of 'expires_by_types' in the current level will be honored.
The expiration time of the 'text/html' MIME type is 24 seconds for the '/url' location. It's 10 seconds for the rest.
The expiration time of the 'text/rss' MIME type is 20 seconds for the '/url' location; The expiration time is 24 seconds for the 'text/html' MIME type and 10 seconds for the rest. Because the the setting in the parent level is overriden by the 'expires_by_types' in the '/url' location, while other 'expires' settings are inherited from the parent level.
The expiration time is not specified in the '/url' location. See Rule 3 above.
The expiration time for the 'text/html' MIME type is 20 seconds in the '/url' location. See Rule 4 above.