On Wed, 2012-09-05 at 15:28 +0200, [email protected] wrote:
> From: Michal Fojtik <[email protected]>
>
> * The Rack::Cascade works nicely with OpenShift
NAK; I don't think Rack::Cascade is the right answer here.
I am wondering if our MatrixParams middleware is ultimately to blame; in
particular, line 88 in sinatra/rack_matrix_params.rb
According to RFC 3875[1] (and what Rack::URLMap does), SCRIPT_NAME
should be the part of the URL that has already been dispatched to, and
PATH_INFO the part that still needs to be handled - that also meshes
with Sinatra's way of processing routes according to PATH_INFO (e.g.
line 860 in sinatra/base.rb for Sinatra 1.3.3)
When I request /api and print the env vars in deltacloud/server.rb, I
get
PATH_INFO="/api"
REQUEST_PATH="/api"
REQUEST_URI="/api"
SCRIPT_NAME="/api"
That's incorrect - PATH_INFO here should be "/" since Rack::URLMap
already set SCRIPT_NAME to "/api", which is what it dispatched to.
Since I don't have good reproducers, especially for your OpenShift
issues, I'll not work on a patch; in general though, I think
MatrixParams should not assign env vars to each other. Instead, it
should gsub the matrix params out of all the env vars that need that
separately.
David
[1] http://www.ietf.org/rfc/rfc3875