Class: Rack::LighttpdScriptNameFix

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/contrib/lighttpd_script_name_fix.rb

Overview

Lighttpd sets the wrong SCRIPT_NAME and PATH_INFO if you mount your FastCGI app at “/”. This middleware fixes this issue.

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ LighttpdScriptNameFix

Returns a new instance of LighttpdScriptNameFix.



6
7
8
# File 'lib/rack/contrib/lighttpd_script_name_fix.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
# File 'lib/rack/contrib/lighttpd_script_name_fix.rb', line 10

def call(env)
  env["PATH_INFO"] = env["SCRIPT_NAME"].to_s + env["PATH_INFO"].to_s
  env["SCRIPT_NAME"] = ""
  @app.call(env)
end