Set `expires` by MIME type

petecooper nginx-forum at
Tue Sep 4 13:41:44 UTC 2018

Francis Daly Wrote:

> It seems to work for me:
> "xml" should have 0s, so now.
> "rss" should have 1h.
> "png" should have 1M.
> $ curl -s -i | grep '^Content-Type\|^Expires'
> Content-Type: text/xml
> Expires: Tue, 04 Sep 2018 12:16:40 GMT
> $ curl -s -i | grep '^Content-Type\|^Expires'
> Content-Type: application/rss+xml
> Expires: Tue, 04 Sep 2018 13:16:41 GMT
> $ curl -s -i | grep '^Content-Type\|^Expires'
> Content-Type: image/png
> Expires: Thu, 04 Oct 2018 12:16:42 GMT

Hello Francis - thank you very much for your sanity check, greatly

I stripped down and rebuilt the `map` this morning and now I'm seeing
successful caching values. I am not certain what changed, and a
before-and-after diff shows nothing of value, so I must put it down to user

> Can you do a test like the above, and show the Content-Type that is
> received as well?

I confirm it's working as expected now, Content-Type and Expires is received

Thank you for your time and attention.

Posted at Nginx Forum:,281087,281094#msg-281094

More information about the nginx mailing list