That's pretty neat, but doesn't it make more sense to use before_filter in your controller for that stuff so that you can properly handle errors instead of showing a 404?
I don't think that the op will want to show a 404 page. If a user is logged in, I will redirect the user to the homepage. Why let the user accesses the login page if the user has already logged in?
So they can use the back arrow and go to the page they at before login redirected them?
I found Drupal's hiding of the login page once I was logged to be truly annoying on a site I regularly visited (till it was apparently changed recently).
You're assuming all requests actually go through to the rails app: what if you have, say, a Sinatra app mounted at '/documentation' and you'd like to check the constraints for that?
I guess that is what the op trying to do.