tracks/public/dispatch.fcgi

24 lines
476 B
Text
Raw Normal View History

#!/usr/bin/env ruby
#
2013-02-25 21:27:03 +01:00
# It requires rails 3
#
require File.dirname(__FILE__) + "/../config/environment"
2013-02-25 21:27:03 +01:00
require 'rack'
require 'fcgi'
class Rack::PathInfoRewriter
2020-10-10 02:27:42 +03:00
def initialize(app)
@app = app
end
2013-02-25 21:27:03 +01:00
2020-10-10 02:27:42 +03:00
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
2013-02-25 21:27:03 +01:00
end
Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(Tracksapp::Application)