Optimize read-only middleware so that it does not consume as much CPU
In !15082 (merged), we changed the behavior of the middleware to call Rails.application.routes.recognize_path
whenever a new route arrived.
However, this can be a CPU-intensive task because Rails needs to allocate memory and compile 850+ different regular expressions, which are complicated
in GitLab.
As a short-term fix, we can do a lightweight string match before we do the heavier comparison.
Closes #40185 (closed), gitlab-com/infrastructure#3240