# Specifying a URI prefix for a route

**URL:** <https://www.ruby-forum.com/t/specifying-a-uri-prefix-for-a-route/146204>\
**Category:** Rails\
**Created:** [August 19, 2008, 1:09am UTC](https://www.ruby-forum.com/t/specifying-a-uri-prefix-for-a-route/146204 "2008-08-19T01:09:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [August 19, 2008, 1:09am UTC](https://www.ruby-forum.com/t/specifying-a-uri-prefix-for-a-route/146204/1 "2008-08-19T01:09:15Z")

</div>

All,

I have an unusual requirement. I have two apps. deployed in a JEE  
container (one Rails, one Merb), and I am redirecting various requests  
between them. That is, from app. A, I am redirecting to a app. B URL  
and vice versa.

Because these are JEE apps., I have to specify a “servlet context” which  
is basically a prefix to keep the docroots of various Web apps.  
distinct. For example, the first app. might be deployed under app\_one,  
so an example URL would look like:

[http://server/app\_one/posts](http://server/app_one/posts)

In this example, the doc root is /app\_one/

I would like to use routes to generate my “cross-app” URLs, but what I  
am running into is that because the URLs from the routes are being  
generated relative to the current document root, I am having to remove  
the current application’s document root from the URL using gsub to get  
the links to work.

Is a parameter than can be used in the routes.rb file (and router.rb in  
the Merb world, if you know) to specify that the generated URI should be  
absolute and not relative to the current docroot?

Thanks,  
Wes

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [September 4, 2008, 1:14pm UTC](https://www.ruby-forum.com/t/specifying-a-uri-prefix-for-a-route/146204/2 "2008-09-04T13:14:10Z")

</div>

if u are using mongrel, you can add the global prefix like this:  
mongrel\_rails start --prefix /myapp  
the Path following --prefix must begin with /

However, i make no senss of deploying app in jee.

On Aug 19, 7:09 am, Wes G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
