pboling / rack-insight

Debugging toolbar for Rack applications implemented as middleware
http://railsbling.com/retired_projects/rack-insight/
MIT License
151 stars 22 forks source link

Support Asset Pipeline with serve_static_assets = false and asset host not the same as rails host #15

Open glebm opened 11 years ago

glebm commented 11 years ago

Rack::Bug runs fine on dev, but I get /__insight__/bookmarklet.js 404 (Not Found) on staging.

This is because of the following settings:

pboling commented 11 years ago

Interesting. I'll look into it. That old bookmarklet is mostly from rack-bug and hasn't really been updated for rack-insight yet. Needs a re-write.

glebm commented 11 years ago

Thanks! Also, it gives me the following error on staging:

Uncaught TypeError: Object #<HTMLDocument> has no method 'insightEnable' 
pboling commented 11 years ago

Ooh. So the panel doesn't work at all for you in staging? This is quite odd. I have it running in multiple environments for me, though none are actually named 'staging', and I don't have those errors. Will look into the other one as well.

glebm commented 11 years ago

I don't think it's the name of the environment. It could be the following settings:

pboling commented 11 years ago

Ah, yes, I have not used it much with asset pipeline, and never with rails serve_static_assets = false, nor with asset host not the same as rails host. This is still a very new gem. You may need to add the rack-insight assets to your asset pipeline build.

glebm commented 11 years ago

How does Rack::Insight serve the assets at the moment? Does it use Rack::Static?

pboling commented 11 years ago

I don't think so. It is probably similar to rack-bug, and I very much doubt it is using Rack::Static, though that sounds like something I should look into.

I think the static assets are served by a very basic, internal, rack app that is designed specifically to handle those requests and filter out all others.

glebm commented 11 years ago

Where is this code? Just point me in the right direction, and I'll try to fix it

pboling commented 11 years ago

Actually... maybe it is using Rack::Static:

https://github.com/pboling/rack-insight/blob/master/lib/rack/insight/rack_static_bug_avoider.rb

Files involved may include:

https://github.com/pboling/rack-insight/blob/master/lib/rack/insight/panel_app.rb https://github.com/pboling/rack-insight/blob/master/lib/rack/insight/path-filter.rb

in https://github.com/pboling/rack-insight/blob/master/lib/rack/insight/options.rb look at line 95: 'rack-insight.path_filters' => %w{/assets/},

That's all I found quickly. This is where I wish github had a per project code search (well they do, but it doesn't work)... In that same lib/rack/insight directory is where all the magic lives.

Please lend you expertise to the project! I'd love to have more committers.