I’ve been working for the last few months on methods to place Rails
applications behind Microsoft’s IIS web server. It’s not the easiest
One of the biggest hurdles when placing Rails apps behind reverse proxy
servers is the fact that when Rails generates URLs with the built-in
like link_to and url_for, they could end up exposing the internal URLs
instead of the ones you want your users to go through.
I’ve developed a plugin that will handle the rewriting for you. All you
to do is install the plugin, provide the appropriate base URL to the
file, and then launch your application in production mode/
- Only runs in production mode so your development can still proceed
the plugin is installed
- You specify the path (protocol, server, and base folder) that you
prepended to the URLs created by Rails.
You can install it via svn. Upon installation, the install script will
you for a base url. Enter it without the trailing slash (
If you need to change it later, you can run the install.rb script in the
plugin folder or just directly modify lib/config.rb.
ruby script/server plugin install
This seems to work very well for our applications… we’ve been using it
a month now on three separate applications.
I would appreciate comments or feedback on this. I doubt it will be that
useful to most people but it’s nice when you need it.