Rack-ESI is a Nokogiri based ESI middleware implementation for Rack with support for include tags, all other ESI namespaced nodes are just removed.
To make this gem work you must define the xmlns:esi namespace in your text/html response.
Note: This gem should only be used in development. For production use setup varnish or any other ESI enabled server.
- threaded (in case we have slow IOs)
- PATH_INFO blacklisting (:skip => nil, should respond to ===)
- support for esi|include[alt] and esi|include[noerror] fallbacks
- Nokogiri
- Rack
$ gem install rack-esi
gem 'rack-esi'
... and ...
$ bundle
use Rack::ESI, options || {}
run Application.new
... for setups w/o Gemfile
config.gem 'rack-esi'
... and ...
config.middleware.insert Rack::Lock, Rack::ESI
config.middleware.insert ActionDispatch::Static, Rack::ESI
config.middleware.insert_before Rack::Lock, Rack::ESI
- poolsize: 4, Number of worker threads. A value of 1 disables threading model.
- skip: nil, This should be an object which responds to #===(PATH_INFO).
- parser: Nokogiri::XML::Document, You can change this to Nokogiri::HTML::Document, but you should change the serializer, too (see below).
- serializer: :to_xhtml, The serializer value specifies the method name which is send to the object created by the parser#parse.
- write documentation
- write more tests
- support more ESI elements
- Fork the project.
- Make your feature addition or bug fix.
- Add tests for it.
- Commit, do not mess with rakefile, version, or history.
- Send me a pull request.
tenderlove and Qerub
Copyright (c) 2011 Florian Aßmann. See LICENSE for details.