views:

142

answers:

1

I've got a web-app that I want to migrate to Rails, which is currently just plain HTML with an Apache proxy to another server, running a custom database/webserver that serves the site's dynamic content.

For the moment, I want to do a staged move, since the content on the proxied server I won't be able to update until I update the static (HTML) server.

So... how would I configure a Rails route to proxy all requests to /dynamic/* to this other server? Or, how would I translate the Apache rule below to Rails?


Apache Proxy Rule:

ProxyPassMatch ^((?i)/dynamic/)(.*)$ http://xxx.xxx.com:8080/$2
ProxyPassReverse /dynamic/ http://xxx.xxx.com:8080/
+1  A: 

Rails routes are used to route some urls to one controller and one action.
You can't make a route to a distant URL or proxying like this.
And that wouldn't be a good idea as it would force us to load all rails (activerecord and everything) when it wouldn't be necessary at all. That's the opposite of scalability.

Using an Apache Proxy rule remains the most appropriate here.

Damien MATHIEU
I gather then that I can continue to use the Apache rule with my Rails app, then? Such that anything directed to `/dynamic/` would never hit Rails but instead go to my remote server?
neezer
That's exactly it !
Damien MATHIEU