Herocu Cedar - Static Assets - Rails 3.0.x

I noticed that heroku injects rails3_serve_static_assets into Cedar when serve_static_assets set to false. All I found on this is this init script , which matches the name given in the Heroku deployment, and all this again activates the static asset service.

I am trying to find more information on how Heroku maintains these assets because they don't seem to just appear directly from the Rails application.

When I look at the headers of the js file, they look something like this:

 Age:0 Connection:close Content-Encoding:gzip Content-Type:text/css Date:Sun, 08 Jan 2012 19:04:05 GMT Last-Modified:Sat, 07 Jan 2012 23:43:30 GMT Server:nginx/0.7.67 Transfer-Encoding:Identity Via:1.1 varnish X-Varnish:677359987 

I assume that Via:1.1 varnish means that these assets are served through Varnish, but with online documentation . on this occasion, says that Lac is not available on Cedar.

Cedar docs on gzipped answers (below) indicate that:

Since requests to Cedar applications are created directly on the application server - not proxied through an HTTP server, such as nginx - any response compression should be performed in your application.

However, we can clearly see that the gzip'd asset matches Content-Encoding . Now I'm pretty sure that Rails 3.0.x does not have Rack::Deflater enabled (it does not appear in rake middleware yet), so I'm a little confused as to how this resource is gzip'd.

This is a kind of preliminary pointer to my next question regarding servicing these assets through Cloudfront, but my question is here:

Can someone explain what exactly is happening in Cedar re: static assets. Namely, what serves my assets (Rails, Ngnix, Varnish?) And what are their gzip'ng?

+2
source share
2 answers

If you see Varnish in your headers, it means that you have CNAME domains pointing to proxy.heroku.com and not proxy.herokuapp.com - there is no varnish on cedars, but you will see that headers are returned if you use proxy.heroku.com and it will work, but it's just a pass. They will be served by nginx.

+3
source

The stack that is used for both the Bamboo stack and the cedar is the same, except for one difference, which is that the varnish cache is not β€œactive” in Cedar. This is because Cedar supports streaming, which is not the case with Varnish.

Therefore, your assets do the same as in your Rails process. With Rails 3.0, they would obviously be just old files. If you use the Asset pipeline on Rails 3.1, the rake assets:precompile will generate gzipped versions of your files for you and serve them.

0
source

Source: https://habr.com/ru/post/1389944/


All Articles