Welcome! Log In Create A New Profile

Advanced

Re: Set `expires` by MIME type

Francis Daly
September 04, 2018 08:22AM
On Mon, Sep 03, 2018 at 04:13:51PM -0400, petecooper wrote:

Hi there,

> I am attempting to use `expires` on Nginx 1.15.3 to define the expiry of
> files on a per MIME type basis.

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

> 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?

"A .php file" could be anything.

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Set `expires` by MIME type

petecooper September 03, 2018 04:13PM

Re: Set `expires` by MIME type

Richard Stanway September 04, 2018 07:10AM

Re: Set `expires` by MIME type

Francis Daly September 04, 2018 08:22AM

Re: Set `expires` by MIME type

petecooper September 04, 2018 09:41AM

Re: Set `expires` by MIME type

Francis Daly September 04, 2018 11:28AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 300
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready