Meteor-files: Nginx expires directive

Created on 8 Jun 2017  路  9Comments  路  Source: veliovgroup/Meteor-Files

I'm having an issue:
trying set nginx expires:

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires 30d;
}

on server with images, but:

curl -I http://mysite.com/cdn/storage/Images/mJ9hv3CRBYAMg9sc5/original/mJ9hv3CRBYAMg9sc5.jpg
HTTP/1.1 200 OK
Server: nginx/1.12.0
Date: Thu, 08 Jun 2017 15:17:02 GMT
Content-Type: image/jpeg
Connection: keep-alive
Content-Disposition: inline; filename="g2.JPG"; filename*=UTF-8''g2.JPG; charset=UTF-8
Cache-Control: public, max-age=31536000, s-maxage=31536000
Accept-Ranges: bytes

i expected like this:
Expires: Mon, 23 Apr 2012 04:26:46 GMT
maybe that's not MeteorFiles problem, but maybe cdn url specific?
Is really MetFiles used CDN format?
Thanks

question

All 9 comments

Hello @valorloff ,

Nginx rules is not applied here, as files served by meteor (node.js) not Nginx

See cacheControl in a Constructor and Custom Response Headers

Hi!
Even if Nginx reverseproxy the node server?
Ok!
i'll trying, thanks

Depends from settings then. Usually it respects proxied server responses

Your default cache-control values override expires and set expires makes no sense, right?

Actually I see no Expires header in response headers you have posted in OP.
You have mentioned CDN, which one you're using?

I learned the task, it seems the cache-control is quite enough.
I thought your meteorFiles uses CDN )
Thanks for help!

Feel free to reopen it in case if the issue still persists on your end.

@dr-dimitru
Is it possible set Content-Encoding: gzip?

Sure, but it should be done by proxy, just enable gzip for proxied servers (for upstreams)

Was this page helpful?
0 / 5 - 0 ratings