REVERSE PROXY PLUGIN v1.03.2 (September 24th, 2007)
© 2006-2007 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 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 trainling 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.
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!
Revisions
* 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-2007 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.