SamSaffron / MiniProfiler

A simple but effective mini-profiler for ASP.NET MVC, ASP.NET and Ruby.
http://miniprofiler.com
1.05k stars 221 forks source link

inserting Rack middleware at position 0 can cause problems with other middleware like Rack::Deflater #131

Open jsierles opened 11 years ago

jsierles commented 11 years ago

On Heroku, Rack::Deflater is required to enable gzip compression on responses. Injecting the profiler before this doesn't work. It might be useful to be able to specify a position at which the middleware should be inserted.

When using the heroku-deflater gem, the actual error is:

Unexpected error while processing request: incompatible character encodings: ASCII-8BIT and UTF-8

This fixes it when run in an initializer:

config.middleware.delete(Rack::MiniProfiler)
config.middleware.insert_after(HerokuDeflater::SkipBinary, Rack::MiniProfiler)
iabdulin commented 11 years ago

https://github.com/SamSaffron/MiniProfiler/issues/149

marcamillion commented 11 years ago

I started getting this error message recently in development, and I am not using heroku-deflator.

What could be causing that?

Edit: I am using thin and the latest version of this gem.

pungoyal commented 11 years ago

any news here?

cheeyeo commented 11 years ago

hi

have a similar problem in development and i'm using Rack::Cache

do i put Rack::Miniprofiler before or after Rack::Cache as it does not seem to work either way?

thanks

gsivaprasad commented 11 years ago

Facing the same problem. Tried both thin and webrick .

SamSaffron commented 11 years ago

I am open to a patch that has the railstie check for Heorku::Deflater or Rack::Defalter and insterts after them if they are there.

Anyone care to give it a shot?