On 25-12-2009 at 10:52, KR wrote:
> Currently the only way to implement sub domain URL's in Stripes seems to be 
> to use mod_rewrite to translate the incoming URL's. Problem with that 
> approach is that you loose the ability to let Stripes generate any links to 
> these actionbeans. Making you're coding more complex and error prone. It's 
> less elegant and less agile.

You can indeed use mod_rewrite for that. But what I think you really want is
a reverse proxy: the proxy acts as if it is the webapp host, but forwards the
requests to the real server behind the scenes.

So if the proxy server receives a request for
        http://customer1.mydomain.com/...
It forwards it to the application server as:
        http://localhost:8080/customer1/...

The proxy server must also rewrite any URL's in the response (also the HTML
body) as were they generated for the proxy server.

I use this virtual host setup for this:

        NameVirtualHost *:80
        <VirtualHost *:80>
                ServerName customer1.mydomain.com
                ProxyRequests off
                ProxyPass http://localhost:8080/customer1
                ProxyPassReverse http://localhost:8080/customer1
                # Use these if the context root also changes (needs 
mod_proxy_html)
                SetOutputFilter proxy-html # For versions prior to 3.1
                #ProxyHTMLEnable On # For version 3.1 and later
                ProxyHTMLURLMap / /customer1/
        </VirtualHost>

You can find more information here:
        http://www.apachetutor.org/admin/reverseproxies


Oscar

-- 
   ,-_  Oscar Westra van Holthe - Kind      http://www.xs4all.nl/~kindop/
  /() )
 (__ (  A: Because people normally read from top to bottom.
=/  ()  Q: Why is top-posting such a bad thing?

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to