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.
expires_by_types 24h text/html; expires_by_types modified +24h text/xml; expires_by_types @15h30m text/xml; expires_by_types 0 text/xml; expires_by_types -1 text/xml; expires_by_types epoch text/xml;
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:
location /url {
expires 10s;
expires_by_types 24s text/html;
}
The expiration time of the 'text/html' MIME type is 24 seconds for the '/url' location. It's 10 seconds for the rest.
expires 10s;
expires_by_types 24s text/html;
location /url {
expires_by_types 20s text/rss;
}
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.
expires 10s;
expires_by_types 24s text/html;
location /url {
expires off;
expires_by_types 20s text/rss;
}
The expiration time is not specified in the '/url' location. See Rule 3 above.
expires off;
expires_by_types 24s text/html;
location /url {
expires_by_types 20s text/rss;
}
The expiration time for the 'text/html' MIME type is 20 seconds in the '/url' location. See Rule 4 above.