RubyFlow The Ruby and Rails community linklog

Rack::ESI gem released

Today I released a small gem, rack-esi. It’s a Rack middleware providing almost the same functionality as Varnish. Features include path blacklisting, type whitelisting, recursion limits, include limits, support for <include> alt and noerror attributes. The main target is to simulate a production environment. [more inside..]

Comments

Will this work on Heroku?

Good to see more implementations :)

I’m not too familiar with Rack; does it use a process per request? Or is it async?

ESI was designed to run in an event-driven, async server.

Install (option => default):<ul><li>path blacklisting (:skip => nil, expects Regexp)</li><li>type whitelisting (:only => /^text\/(?:x|ht)ml/)</li><li>recursion limit (:depth => 5)</li><li>include limits (:includes => 32)</li><li>support for <include> alt and noerror attributes</li></ul> It’s main target is to simulate production environment.

Installation:

gem install rack-esi

Rails Setup (environment.rb):

config.gem 'rack-esi'
config.middleware.use(Rack::ESI, opts = {})

Links:<ul><li>Github</a></li><li>ESI language specification</li></ul>

Cheers Florian

Installation

<code>gem install rack-esi</code>

Rails Setup (environment.rb)

<code>config.gem 'rack-esi'
config.middleware.use(Rack::ESI, opts = {})</code>

Source

RoaR: Rack-ESI was designed for developing purposes. I don’t tried Heroku yet, but when they run Rack apps it should work. I suggest you use another Cache middleware between Rack-ESI and [App] since Rack::ESI only replaces ESI elements. But this is far away from what you want to do with ESI.

Heroku | How It Works shows where your app is located. A real ESI implementation should work at reverse proxy level, not at Dyno level.

Mark Nottingham: Rack is not decoupled from the app like a reverse proxy. The app and rack live in the same process and when a page is requested Rack::ESI parses the html with Nokogiri calls the app for includes and replaces them. This happens synchronously.

As I mentioned before, I coded Rack::ESI for development purposes. As long as I don’t implement the cache and the invalidation protocol to build a reverse proxy based on Rack the app and the middleware will still use the same process.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in