diff --git a/config/environments/development.rb b/config/environments/development.rb index 6edea4c1fcf..ee06ba01b4f 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -41,8 +41,8 @@ Discourse::Application.configure do config.load_mini_profiler = true require 'middleware/turbo_dev' - require 'middleware/missing_avatars' config.middleware.insert 0, Middleware::TurboDev + require 'middleware/missing_avatars' config.middleware.insert 1, Middleware::MissingAvatars config.enable_anon_caching = false diff --git a/config/initializers/06-mini_profiler.rb b/config/initializers/06-mini_profiler.rb index cc583b4bb39..4feac54b987 100644 --- a/config/initializers/06-mini_profiler.rb +++ b/config/initializers/06-mini_profiler.rb @@ -18,21 +18,28 @@ if defined?(Rack::MiniProfiler) # namespacing gets complex, cause mini profiler is in the rack chain way before multisite Rack::MiniProfiler.config.storage_instance = Rack::MiniProfiler::RedisStore.new(connection: DiscourseRedis.raw_connection) + skip = [ + /^\/message-bus/, + /topics\/timings/, + /assets/, + /\/user_avatar\//, + /\/letter_avatar\//, + /\/highlight-js\//, + /qunit/, + /srv\/status/, + /commits-widget/, + /^\/cdn_asset/, + /^\/logs/, + /^\/site_customizations/, + /^\/uploads/ + ] + # For our app, let's just show mini profiler always, polling is chatty so nuke that Rack::MiniProfiler.config.pre_authorize_cb = lambda do |env| path = env['PATH_INFO'] + (env['HTTP_USER_AGENT'] !~ /iPad|iPhone|Nexus 7|Android/) && - (path !~ /^\/message-bus/) && - (path !~ /topics\/timings/) && - (path !~ /assets/) && - (path !~ /\/user_avatar\//) && - (path !~ /\/letter_avatar\//) && - (path !~ /\/highlight-js\//) && - (path !~ /qunit/) && - (path !~ /srv\/status/) && - (path !~ /commits-widget/) && - (path !~ /^\/cdn_asset/) && - (path !~ /^\/logs/) + (env['REQUEST_METHOD'] != "GET" || !skip.any?{|re| re =~ path}) end # without a user provider our results will use the ip address for namespacing