CARVIEW |
Every repository with this icon (

Every repository with this icon (

Run the following if you haven't already:
gem sources -a https://gems.github.com
Install the gem(s):
sudo gem install DefV-rack_lighttpd_fix
Description: | Lighttpd fix to set correct PATH_INFO edit |
Homepage: | https://workswithruby.com/2009/7/rack-cache-and-lighttpd-fcgi edit |
Public Clone URL: |
git://github.com/DefV/rack_lighttpd_fix.git
Give this clone URL to anyone.
git clone git://github.com/DefV/rack_lighttpd_fix.git
|
Your Clone URL: |
Use this clone URL yourself.
git clone git@github.com:DefV/rack_lighttpd_fix.git
|

name | age | message | |
---|---|---|---|
![]() |
README.rdoc | Loading commit data... ![]() |
|
![]() |
doc/ | ||
![]() |
lib/ | ||
![]() |
rack_lighttpd_fix.gemspec | ||
![]() |
test/ |
Rack::LighttpdFix
Why?
On some of the Openminds shared hosting servers we run a Lighttpd+FCGI stack for Ruby/Rails applications. This week we got a complaint from a user saying they had a problem with the latest Radiant 0.8. Every page he loaded was the same as the first page he opened since the last server restart.
When digging into the problem it was clear that it was a problem with Rack::Cache, which only created 1 meta-store entry and served that from there on. On investigation Rack::Cache::Key.call(@request) always returned example.com:80/dispatch.fcgi?. Apparently the last part of the key gets created by scriptname and pathinfo:
..snip.. parts << @request.script_name parts << @request.path_info ..snip..
When looking at the request it seems Lighttpd+FCGI doesn’t fill in the env[‘PATH_INFO?], which results in always having the same cache key, thus the same page.
To solve this problem I’ve created this small Rack middleware gem that sets PATH_INFO from REQUEST_URI (Like Passenger does with Nginx)
Installation
You can just install this as a gem:
gem install -s https://gems.github.com defv-rack_lighttpd_fix
Configuration for Rails
# in production.rb require 'rack/lighttpd_fix' config.middleware.insert_before ::Rack::Cache, ::Rack::LighttpdFix # or for Radiant config.middleware.insert_before ::Radiant::Cache, ::Rack::LighttpdFix