#=REVERSE PROXY PLUGIN Version 1.0.6.0 (March 16th, 2009) #===© 2006-2009 Brian Hogan # #==Introduction # This plugin is designed to allow your Rails application to reside behind a reverse proxy. # When the plugin is configured and the application is running in production mode, any URLs generated # by Rails helpers will automatically be prefixed with the host and path you specify. # #==Example Usage # An organization may be interested in running a Rails application behind a reverse proxy such as Apache. However, # any URLs generated by the Rails appliction would expose the proxy. # # For example, a front-end server http://www.mydomain.com/app1/ might be mapped to http://backend.mydomain.com:3000/ # # The plugin would be configured to prepend http://www.mydomain.com/app1 to all URLs generated by the application. # #==Usage and Configuration # Install via Subversion using the Ruby script/plugin install command. In the root of your Rails application structure # (where you can see the app/ vendor/ and public/ folders) # execute the following command: # # ruby script/plugin install http://svn.napcsweb.com/public/reverse_proxy_fix # # You will be prompted by the script to specify the version of Rails you're using. Select # the version that best matches your version of Rails and press the Enter key. # You should be prompted to enter the base url of your front-end server when you install # the plugin via script/plugin install. You should not include the trailing slash! For # example: # # http://www.mydomain.com/typo # # If that doesn't work for some reason, you can run the install.rb script in # # vendor/plugins/reverse_proxy_fix # # Or you can manually edit the file lib/config.rb and uncomment the BASE_URL line. (It should be the only line in the file. Enter the desired base url # that you would like the plugin to prepend to any generated URLs. # #== Running In Production # # This plugin only operates in production mode. # #==Versions of Rails # # This plugin supports Rails 1.x, Rails 1.2.x, and Rails 2.0 by using separate files for each Rails version # During the installation you'll need to tell the plugin which version to use. If this fails for some reason, # simply rename the appropriate file to reverse_proxy_fix.rb # * 116.rb (Rails 1.1.6 or below) # * 123.rb (Rails 1.2.X) # * 20.rb (Rails 2.0-2.2) # * 23.rb (Rails 2.3.x) # # Then start your application in Production mode. The plugin is automatically disabled when you run in development mode, so you don't # need to do any special configurations to develop your application. # # That's it! # #= Limitations # # First, asset hosts are disabled and overruled by this plugin. Your asset host base URL is set to the base url you specify. Modify the plugin to change this behavior. I am open to patches for this, and am also looking at better solutions. # # Second, in order to get named routes working in Rails 2.0 I took the shortcut and disabled route optimization. This is suboptimal, and am looking for patches from users. # #= Revisions # #== Version 1.0.6.0 # # * Added support for Rails 2.3 # #== Version 1.0.5.2 # * Updated install script to specify that this does in fact work with Rails 2.1 and 2.2. # #== Version 1.0.5.1 # * Updated the readme version and fixed the installation script so it worked for platforms other than Windows (Thanks to Brian Candler for catching this and supplying a patch) # #== Version 1.0.5 # * Fixed the issue that prevented named routes from not working in Rails 2.0 by disabling named route optimization. # #== Version 1.0.4.1 # * Fixed the installer script to properly select Rails version. (Joshua Miller) # #== Version 1.0.4.0 # * Added support for Rails 2.0 - needs more testing # #== Version 1.0.3.2 # * Unified installer for all Rails versions again. # #== Version 1.0.3.1 # * Fixed an issue when using RESTful routing - plugin should no longer activate in dev mode. # #== Version 1.0.3 # * Added a rake task to configure the plugin # * fixed a situation where the installer didn't work in Rails 1.2.3 # * fixed a problem with request.request_uri not setting the base path. # * Overloaded routing mechanism to avoid collisions with the modified request.request_uri # * Tested with acts_as_authenticated # #== Version 1.0.2 # * Fixed issue where page caching does not work. The URL rewriting can now be turned off by sending *:skip_relative_url_root => true* to any calls to url_for or link_to. (This is the method that caching uses to build the cached urls) # #== Version 1.0.1 # * Small bug fix to allow :only_path => false to work correctly when called on link_to and url_for # #== Version 1.0 # * Initial Release # #==License # Copyright © 2006-2009 Brian Hogan # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.