johnbintz/rack-livereload

Middleware Ordering Issue - Prevents `flash.keep` Use and Adds Log Verbosity

Closed this issue · 0 comments

Using

config.middleware.use Rack::LiveReload 

positions the middleware after ActiveRecord::SessionStore.

This is a problem when in development you use flash.keep since requests for livereload assets will go through the session store and thus void the use of flash.keep. Instead, using the following works much better:

config.middleware.insert_after ActionDispatch::Static, Rack::LiveReload

Not only will your session store not be touched, but you also save yourself some logging verbosity by not logging the GET requests for livereload's static assets.

I'll try to make a PR for the README soon.