Question: I followed these instructions to deploy my rails app to a suburi: 

<http://www.modrails.com/documentation/Users%20guide%20Apache.html#deploying_rails_to_sub_uri> 

On Dec. 23 my application was deployed under a suburi and working fine. When I tried it on dec. 26 I noticed that url helpers like stylesheet\_link\_tag were no longer using the RackBaseURI. So instead of requesting //myapp.com/suburi/app/assets/application.css my browser was requesting //myapp.com/assets/application.css Of course that's a 404. I looked at all my logs from both the app and apache, and didn't see anything suspicious.

Restarting apache made the suburi suddenly start working again.

Here is my vhost.conf <https://gist.github.com/4382822>

Anyone have any ideas what I might be doing wrong?

Answer: 
So I finally figured this out. The problem was that if you have a passenger app set to use a sub-uri like <http://local-webservice.localhost/sub/uri/route>, but the first request after restart hits the app via the root like <http://local-webservice.localhost/route> then passenger will essentially throw away your sub-uri configuration until you restart the app.

The solution to this was given to me [in the passenger google group](https://groups.google.com/forum/?fromgroups=#!topic/phusion-passenger/OztSsKQGHXs), but i'm including it here in the hopes it helps somebody else. Here is the answer i got there:

> 
> This is due to the way Phusion Passenger currently uniquely identifies
>  applications. It currently does so only through the application root. 
>  Suppose you have /webapps/foo deployed on foo.com, bar.com and 
>  baz.com/suburi. Phusion Passenger will recognize them all as being the
>  same application, just under different domains and sub-URIs. 
> 
> 
> This is something we want to fix in future versions. But for now, to 
>  make it work as you expect, set a different PassengerAppGroupName for 
>  your sub-URI deployment. For example:
> 
> 
> 

```
<Location /suburi/app> 
  PassengerAppGroupName suburi_app 
</Location> 

```
there's nothing I can see you're doing wrong from what you've provided. Perhaps it was a bug in Passenger. 

I can't think of anything that would make RackBaseURI start out working, then stop working without an apache restart, then start working again after an apache restart with no other changes -- except a bug in passenger. Hopefully it won't happen again. I do use regularly RackBaseURI myself, and have not seen this problem.

It's also possible (and perhaps more likely) that something weird happened which was not a bug in passenger, but which we don't have enough info about here to know. You sure apache didn't restart between dec 23 and 26? You sure you didn't change any configuration files (apache or rails) in there at any point? Or precompile your assets or create or delete files in ./tmp/cache or anything? (None of those latter ones would obviously break things in any way, but they are things that could at least conceivably be related. It's the works-doesn't-works with no changes to any files whatsoever that is somewhat inconceivable (to me anyway!) but for a bug in passenger.