New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MiniProfiler's Built in route is returning 404 on production #462
Comments
Running a rails 5, ruby 2.6 API that returns JSON to React frontend. Experiencing similar behavior, however setting the authorization_mode to ":allow_all" in the initializer works for me. Using ":whitelist" should enforce (per the docs) whitelisting on a per controller/action basis when running in production env. I'm attempting to control access to profiling using the recommended approach of a "before_action" in the application controller which authorizes the profile request if the current_user is an admin. Production env returns a 404 when accessing the "/rack-mini-profiler/requests" route. Summary: :whitelist option in the initializer, used in conjunction with a before_action to allow access is not working as expected in production env and returns a 404 for the built in profiling route. |
@OsamaSayegh any ideas about what is going on here. |
I am also seeing this on a Rails 6.1 application, vanilla ERB frontend, Ruby 2.6. before_action do
if Rails.env.development? || current_user&.admin?
Rack::MiniProfiler.authorize_request
end
end And in the initializer: require "rack-mini-profiler"
Rack::MiniProfilerRails.initialize!(Rails.application)
if Rails.env.production?
redis_url = ENV["REDISCLOUD_URL"] || ENV["REDIS_URL"]
Rack::MiniProfiler.config.storage_options = { url: redis_url }
Rack::MiniProfiler.config.storage = Rack::MiniProfiler::RedisStore
end This is on Heroku. In another issue I saw that changing to filestore helped. The 404 went away, but so did rack profiler 🙃 |
@yuta17 @coreypmurphy @jules2689 sorry for the late response here. I have a question for you: if you visit any route of your application, does Mini Profiler's speed badge show up at all? In other words, is it only the |
It had been showing up for me somewhat sporadically @OsamaSayegh, but I ended up removing it from my project for now. I can try adding it back in the near future though |
Any update on this? I'm seeing the same thing. @OsamaSayegh I'm configuring this with
Nope, not with
Opening the JS ( |
Also bumped into this when running some tests. My understanding is that the code for As explained in https://github.com/MiniProfiler/rack-mini-profiler#access-control-in-non-development-environments, by default profiling needs to be enabled per request (when My solution for this was to create my own blank page, which was also under internal authentication, and ensure Another thing to consider is that with |
I think @sergiopatricio has explained the issue. To resolve this issue: We should implement a better way for users who only use |
I want to use built in route on production.
But
/rack-mini-profiler/requests
route is returning 404. Any ideas?It's running on Ruby on Rails.
The text was updated successfully, but these errors were encountered: