Closed

Description
The Rack::URLMap
class in (used by Rack::Builder
, a commonly used utility) expects a SCRIPT_NAME
parameter. When env['SCRIPT_NAME']
is nil
, the following line causes a crash.
https://github.com/rack/rack/blob/98dbe17dd1e552783e056af15f4632ae4d462cc6/lib/rack/urlmap.rb#L73
undefined method `+' for nil:NilClass (NoMethodError)
I used the following middleware hack to temporarily fix it.
require 'rack'
class NginxPatcher
def initialize(app)
@app = app
end
def call(env)
env[Rack::SCRIPT_NAME] ||= ''
@app.call(env)
end
end
In config.ru:
use NginxPatcher
I don't really care about the value of SCRIPT_NAME
and I don't use it for anything. However, it would be nice if Unit would set this to an empty string at least so that the internals of Rack don't crash under normal use. SCRIPT_NAME
is mentioned in the Rack spec, so it would be nice to have some kind of guarantees that the the spec is implemented at least to a point where it doesn't crash.
Metadata
Metadata
Assignees
Type
Projects
Status
🚀 Released