Rails + Passenger on Heroku: How to set expiry date or a maximum age in the HTTP headers for static resources?

15 views
Skip to first unread message

Amr Noman

unread,
Jan 14, 2016, 3:41:44 AM1/14/16
to Phusion Passenger Discussions

I'm using Rails api with an angularjs front-end which is served simply as static files under public directory (no sprockets or rails asset pipeline involved).

I've chosen passenger as the app server, deployed to heroku and everything seems to be working fine except for caching.

Since static assets are served directly by passenger/nginx, I believe this has nothing to do with rails, is this correct?

But I have no idea how to get it working or where to add configurations.


Response headers when requesting a static file (application-a24e9c3607.js):


Connection: keep-alive
Content-Length: 0
Date: Thu, 14 Jan 2016 06:45:31 GMT
Etag: "5696ce02-43102"
Last-Modified: Wed, 13 Jan 2016 22:21:54 GMT
Server: nginx/1.8.0
Via: 1.1 vegur

Any help appreciated. Thanks.

Daniel Knoppel

unread,
Jan 14, 2016, 7:30:09 AM1/14/16
to Phusion Passenger Discussions
Yes, Passenger lets Nginx serve the static file for optimal performance. Nginx options for Passenger Standalone/Nginx can be set through the nginx config template.

- Daniel

Amr Noman

unread,
Jan 14, 2016, 9:48:10 AM1/14/16
to Phusion Passenger Discussions
Yes, thank you. I was able to find the solution and answered my own question here.
Thanks again, cheers :)
Reply all
Reply to author
Forward
0 new messages