Address middleware insertion order for threadsafety

Rails 4 is threadsafe by default