PDA

View Full Version : Rails App on same server, different domain.


NicholasOrr
11-12-2007, 03:01 AM
I've made a RoR app that works great. It's more of a service and doesn't really have any webpages. It has an Admin page, but nothing for users/clients.

The PHP CMS sites on the same LSWS webserver are the pages and they need to use the RoR app. It's all AJAX interactive. The PHP app sends of requests to the rails app, the RoR app consumes the info and responds and the PHP app takes care of all the Look & Feel and client interactions.

I was thinking of using reverse proxy from the PHP to RoR app - or is there a better way? These apps are on the same server - Different domains. JS you need to be aware of the domain security thing...

Thanks

mistwang
11-12-2007, 08:13 AM
Why not put them under the same domain and save the headache?

NicholasOrr
11-12-2007, 03:39 PM
Ok

Its a loan calculator

The calculator appears on different websites.

I could have 15 calculators or 1 calculator - I'd like to maintain 1.

That's why its not on the same domain....

mistwang
11-12-2007, 03:52 PM
You can use one copy of code, just add a "Rails" context to each vhost using it. Just make sure all vhosts are owned by the same user.

If you want to pursue the proxy route, you have to assign the vhost of the Rails App a different IP other than the IPs of vhosts using it. When you assign the listener to vhost mapping, just "*" to match all domains. Create an web server application pointing to the IP : port of the Rails App.

Then you can create a proxy context for each vhost needs to use the Rails app, the context URI is same as the Rails context URI. The handler will be the web server application just created.

This way, all requests to the calculator will be proxy to the Rails vhost.