ANN: Reverse_Proxy_fix

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
thing
to do.

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
methods
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
have
to do is install the plugin, provide the appropriate base URL to the
config
file, and then launch your application in production mode/

Key features:

  • Only runs in production mode so your development can still proceed
    when
    the plugin is installed
  • You specify the path (protocol, server, and base folder) that you
    want
    prepended to the URLs created by Rails.

You can install it via svn. Upon installation, the install script will
ask
you for a base url. Enter it without the trailing slash (
http://myserver.mydomain.com/myapp)
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
http://svn.napcsweb.com/public/reverse_proxy_fix

This seems to work very well for our applications… we’ve been using it
for
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.