I recently implemented something similar, and one issue I ran in to was that $sent_http_content_type doesn't always map to a mime type. For example, "Content-Type: text/html" would match mime type text/html, but "Content-Type: text/html; charset=utf-8" would match only the default. You need to all Content-Type header variants to your map for it to work as expected, or use a regular expression.
> In the browser inspector, all MIME types are assigned a 1 month expiry, as
> if they're inheriting the `default` value from the map. Example headers for
> a .php file:
> Date: Mon, 03 Sep 2018 20:09:30 GMT
> Expires: Wed, 03 Oct 2018 20:09:30 GMT
Can you do a test like the above, and show the Content-Type that is
received as well?
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 http://127.0.0.1/a.xml | grep '^Content-Type\|^Expires'
> Content-Type: text/xml
> Expires: Tue, 04 Sep 2018 12:16:40 GMT
> $ curl -s -i http://127.0.0.1/a.rss | grep '^Content-Type\|^Expires'
> Content-Type: application/rss+xml
> Expires: Tue, 04 Sep 2018 13:16:41 GMT
> $ curl -s -i http://127.0.0.1/a.png | 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