# Webrick mount app

**URL:** <https://www.ruby-forum.com/t/webrick-mount-app/148003>\
**Category:** Rails\
**Created:** [September 8, 2008, 8:13am UTC](https://www.ruby-forum.com/t/webrick-mount-app/148003 "2008-09-08T08:13:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![samrus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecd19e/32.png) [@samrus](https://www.ruby-forum.com/u/samrus)\
**Post date:** [September 8, 2008, 8:13am UTC](https://www.ruby-forum.com/t/webrick-mount-app/148003/1 "2008-09-08T08:13:46Z")

</div>

Hi All,

I am currently developing against webrick and as such my application  
appears under [http://localhost:3000/](http://localhost:3000/) but in my continuous integration  
environment (jruby war deployed to tomcat) the application appears  
under [http://localhost:8080/myapp](http://localhost:8080/myapp)  
This is a pain when writing Selenium tests because in development I  
can use commands such as…  
open /foo  
… but the ci needs to use …  
open /myapp/foo

Note that I think this is a deficiency in the SeleneseAntTask which  
accepts a startURL, but … “Note that only the hostname part of this  
URL will really be used.”  
So… instead I’m wanting a “quick” solution by setting an application  
context on webrick.

I thought this was possible just by using …  
server.mount( ‘/myapp’, … )  
… but when I do this Rails gives me a routing error… eg,

No route matches “/myapp/foo” with {:method=\>:get}

So, I’m assuming I’m missing something in my webrick config in order  
to mount myapp? … or do I need to add something to routes.rb?

ps. I originally posted this to  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails) but had no reply  
from anyone… even after mailing removed\_email\_address@domain.invalid to  
find out what was going on … so is that list defunct?

---

<div class="post-metadata">

**Author:** ![samrus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecd19e/32.png) [@samrus](https://www.ruby-forum.com/u/samrus)\
**Post date:** [September 19, 2008, 2:17am UTC](https://www.ruby-forum.com/t/webrick-mount-app/148003/2 "2008-09-19T02:17:55Z")

</div>

So, no one can help me with this? … have I posted to the wrong forum?  
… should I have posted to Rails Deployment?

---

<div class="post-metadata">

**Author:** ![samrus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecd19e/32.png) [@samrus](https://www.ruby-forum.com/u/samrus)\
**Post date:** [September 19, 2008, 4:45am UTC](https://www.ruby-forum.com/t/webrick-mount-app/148003/3 "2008-09-19T04:45:29Z")

</div>

What do you need help with? No, sure!

On Fri, Sep 19, 2008 at 9:17 AM, Sam R. \<

---

<div class="post-metadata">

**Author:** ![samrus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecd19e/32.png) [@samrus](https://www.ruby-forum.com/u/samrus)\
**Post date:** [September 20, 2008, 11:12am UTC](https://www.ruby-forum.com/t/webrick-mount-app/148003/4 "2008-09-20T11:12:05Z")

</div>

On Sep 18, 9:36 pm, Sam R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> How do I deploy an application to webrick that can then be found under a  
> specified application context such as localhost:3000/myapp rather than  
> the default localhost:3000

Add it into config/routes.rb:  
map.connect ‘myapp/:controller/:action/:id’  
map.connect ‘myapp/:controller/:action/:id.:format’

For mapped resources, use the namespace. Here’s the example in my  
routes.rb:

# Sample resource route within a namespace:

# map.namespace :admin do |admin|

# # Directs /admin/products/\* to Admin::ProductsController (app/

controllers/admin/products\_controller.rb)

# admin.resources :products

# end

This probably isn’t the “right” way. Another option would be to use  
apache to proxy the requests, either proxying and reverse proxying /  
myapp to / to webbrick, or proxying and reverse proxying / to /myapp  
for tomcat.

Kevin

---

<div class="post-metadata">

**Author:** ![samrus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecd19e/32.png) [@samrus](https://www.ruby-forum.com/u/samrus)\
**Post date:** [September 19, 2008, 6:36am UTC](https://www.ruby-forum.com/t/webrick-mount-app/148003/5 "2008-09-19T06:36:31Z")

</div>

How do I deploy an application to webrick that can then be found under a  
specified application context such as localhost:3000/myapp rather than  
the default localhost:3000

---

<div class="post-metadata">

**Author:** ![samrus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecd19e/32.png) [@samrus](https://www.ruby-forum.com/u/samrus)\
**Post date:** [September 22, 2008, 2:05am UTC](https://www.ruby-forum.com/t/webrick-mount-app/148003/6 "2008-09-22T02:05:00Z")

</div>

Thanks Kevin, that indeed works on webrick but it does kill the tomcat  
version.  
No matther though because it can be reconfigured based on environment.  
So … Thanks!
