rstacruz / sinatra-assetpack

Package your assets transparently in Sinatra.
http://ricostacruz.com/sinatra-assetpack/
MIT License
542 stars 97 forks source link

AssetPack 0.2.3 prepends URL sub-path to asset urls. #105

Closed syntruth closed 11 years ago

syntruth commented 11 years ago

Updated to 0.2.3 today, reloaded my development site and on any sub-path URL, AssetPath is prepending that sub-path to the asset url:

GET http://dev-site-url-here/users/js/jquery.4a9204dc7089fbd2c922cd21ddb606aa.js 404 (Not Found)

It works as expected on the root URL.

Reverting back to 0.2.2 worked as expected.

syntruth commented 11 years ago

I am thinking that this stems from this merge -- due to requiring NTLMv2 authentication on the network, and the NTLMv2 Apache mod we use, there is some request path mangling that goes on. In fact, this is how I work around it in a Sinatra before block:

# Have to do this, because Apache+mod_python (used for
# the PyAuthenNTLMv2 module) mangles the script_name and
# path_info variables. This is not a bug, just old-school
# that nobody does anymore.
# NOTE: we have to remove any query string or else paths
# won't match.
query = request.env['QUERY_STRING']
uri   = request.env['REQUEST_URI']
uri.gsub!(/\?#{Regexp.escape(query)}/, '') unless query.empty?

request.path_info = uri

This isn't ideal, of course, BUT it is what it is, and what we have to do to get sites working on our internal network. I'm not seeing an easy fix for this other than sticking to AssetPack 0.2.2 for now.

j15e commented 11 years ago

Hum, that is kind of problematic yeah. Isn't it possible to also change the request.script_name with the same value?

You should be able to do this : http://rack.rubyforge.org/doc/Rack/Request.html#method-i-script_name-3D

j15e commented 11 years ago

Any update on thic @syntruth ?

j15e commented 11 years ago

Will re-open if I get updates on this, otherwise considered fixed.