No commit activity in last 3 years
No release in over 3 years
Rack Middleware to fix Apache's PATH_INFO issues where SCRIPT_NAME is stripped from it.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Rack PathInfo Fix Middleware

This Rack middleware is very simply and only does one thing: fixes the PATH_INFO environment variable. Apache and mod_python messes up the path info, by stripping the first path segment from it and setting the SCRIPT_NAME to that segment. This isn't wrong behaviour, but Rack applications expect the segement there when matching up mapped routes.

Install

To install via gems:

gem install rack-pathinfo-fix

Or, if you are using the preferred method of Bundler, in your Gemfile:

gem 'rack-pathinfo-fix'

Usage

In your config.ru

require 'rack_pathinfo_fix' # If you're not using Bundler.
require 'app.rb'            # whatever your app file is.

use RackPathInfoFix

run App

This also fixes things if you have to map other handlers:

use RackPathInfoFix

map '/assets' do
  run AssetsHandler
end

map '/'
  run App
end

This README is longer than the actual middleware class. :)