Passenger/RackBaseURI issues with paths

I’m working on a Rails app and trying to get rack-mini-profiler running in Production env. Things are partly working, but there’s a few issues I’m having trouble sorting out.
Our config’s using Passenger 4.0.53 with Apache/SSL, Ruby 2.0/Rails 3.2
Passenger’s got a RackBaseURI set to “/web/”, and we use config.action_controller.relative_url_root = “/web” (using RailsBaseURI makes no difference here)
Initially the request to /mini-profiler-resources/includes.js would fail with a 404 (no leading /web/ so Passenger never got it), so I added a RedirectMatch:
RedirectMatch ^/mini-profiler-resources(.*)$ /webui/mini-profiler-resources$1
This got the JS/CSS/jquery-tmpl to load, and things sort of work. I can append pp=help to get help, though the URLs are all missing the ‘/web/’ prefix. Using ?pp=analyze-memory, etc work with a fixed path, and I see files building up in tmp/miniprofiler with interesting content

When we load the pages, the Profiler box never appears, and we get a lot of 404 errors for
https://[server ip]/web/mini-profiler-resources/results
I think this may an attempt to POST that’s choking on the redirect (no idea, really, though)

I tried to pull the redirect and set Rack::MiniProfiler.config.base_url_path = '/web/' but this caused 500 errors with things like:
ActionController::RoutingError (No route matches [GET] "/monitoring/web/includes.js")
Trying base_url_path = ‘/web/mini-profiler-resources/’ also throws 500 errors with:
ActionController::RoutingError (No route matches [GET] "/mini-profiler-resources/includes.js")
the base_url_path is a bit of a mystery…

Is there a way to configure rack-mini-profiler to be aware/use the RackBaseURI prefix so I can get rid of the Apache redirect and get the resources to use the desired path?

We have base_url_path that you can define in config, have you tried that?

Sorry for the delayed reply.

I’m having what I believe to be the same problem.

Changing base_url_path does direct the client to fetch includes.js and other resources from base_url_path/. However, serve_html in profiler.rb also uses seeks base_url_path as a prefix of the PATH_INFO being fetched. When using passenger with RackBaseURI/RailsBaseURI/PassengerBaseURI, the prefix is stripped before serve_html sees the url being fetched, so none of the profiler.rb code responds to requests.

The following ugly-patch works with base_url_path, you know, sort of. Also helpful (and much simpler) is to revert c12506234b47eea9446a083e20d49b65c166c9eb .

— profiler.rb 2016-02-15 14:47:32.000000000 -0500
+++ /var/lib/gems/2.1.0/gems/rack-mini-profiler-0.9.8/lib/mini_profiler/profiler.rb 2016-02-15 14:55:32.000000000 -0500
@@ -113,7 +113,7 @@

     def serve_html(env)
-      file_name = env['PATH_INFO'][(@config.base_url_path.length)..1000]
+      file_name = env['PATH_INFO'][("/mini-profiler-resources/".length)..1000]
       return serve_results(env) if file_name.eql?('results')

@@ -175,7 +175,7 @@

       # handle all /mini-profiler requests here
-      return serve_html(env) if path.start_with? @config.base_url_path
+      return serve_html(env) if path.start_with? @config.base_url_path or path.start_with? "/mini-profiler-resources/"

       has_disable_cookie = client_settings.disable_profiling?
       # manual session disable / enable