|
How do I get Rails3 apps running correctly in a subdirectory (ie. http://username.webfactional.com/app_name/) Without touching the routes file, I can access login/public pages (etc).
the static files work. Now I need the links/routes to work correctly. Using scoped routes:
are the "official" way to do this. However, I assume due to how Apache handles the app requests the /app_name/ part of the route never makes it to the mapping. I always get this error:
Obviously, /login won't exists since the scoping makes the url matching /app_name/login. |
|
For those who have the same question: The Official Answer from Webfaction is that its not possible on their servers. Their front-end server removes the /app_name when it sends requests so the routes will never see that. The only option is to duplicate all routes. The first copy is your normal copy. The second copy is scoped to use your "/app_name" in front. Either all that work, or use a subdomain (what I did). |
Did you try just mounting the application to that sub-directory in the control panel? Most frameworks will 'just-work' set up like this.
I created the application and linked the application (websites tab) in the control panel. I can access static files (stylesheets, javascript, etc) from the subdirectory so the apache/nginx/passenger transfer is OK.
The rails routes are the issue, not being able to understand it is in a subdirectory. So every route says "Route not found". The url passed to it from passenger is only "/route". That's a problem since it's looking for "/route" instead of "/app_name/route"