Skip to content

Instantly share code, notes, and snippets.

@metacritical
Created February 8, 2012 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metacritical/1773136 to your computer and use it in GitHub Desktop.
Save metacritical/1773136 to your computer and use it in GitHub Desktop.
Some CGI dispatch file for use ...
require 'rubygems'
require 'fcgi'
ENV['RAILS_ENV'] ||= 'development'
ENV['GEM_HOME'] ||= '/home/user/.gems'
require 'rubygems'
Gem.clear_paths
require File.join(File.dirname(__FILE__), '../config/environment')
class Rack::PathInfoRewriter
def initialize(app)
@app = app
end
def call(env)
env.delete('SCRIPT_NAME')
parts = env['REQUEST_URI'].split('?')
env['PATH_INFO'] = parts[0]
env['QUERY_STRING'] = parts[1].to_s
@app.call(env)
end
end
Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(X::Application)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment