Skip to content Skip to navigation

Reverse Proxy Module - Version 1

Posted by: 
Topics: 
Tags: 

Note: There now is a Version 2 of the Reverse Proxy module available for Drupal 6. You should use it for new Drupal installs.

Previously, configuring Drupal to work in the Leland web environment with a Virtual Host Proxy (aka, "Vanity URL") required making changes to includes/bootstrap.inc. However, this presented several problems:

  1. You should not modify Drupal core
  2. It complicates upgrading
  3. You should not modify Drupal core

The Stanford Open Source Lab is pleased to present the Reverse Proxy module for Drupal 5 and Drupal 6, now available for beta testing. Please read the README.txt, included with the module and highlighted below, before installing. Bug reports and feature requests can be filed in the comments section of this post.

Two things to be aware of:
  1. Only enable the Reverse Proxy module if the site is using a Virtual Host Proxy. If the module is enabled on a site that is not using a Virtual Host Proxy, it will cause problems.
  2. Special steps need to be taken when updating Drupal core for a site using a Virtual Host Proxy and the Reverse Proxy module, because normally one disables all contributed modules in the process of updating Drupal core but the problems Reverse Proxy module fixes return when it is disabled, which messes up the update. Either of these two approaches should help you avoid problems:
  • Easier but diverging from update instructions: Disable all contributed modules except Reverse Proxy at that stage in the update process
  • Allows following update instructions exactly: Before updating, temporarily comment out your base url in settings.php. Use the long form of the url until after the update is complete. After the update, un-comment the base url in settings.php.
Special thanks are due to Marco Wise, Vijoy Abraham, Zach Chandler, Irina Zaks, and Dustin Selman for their work on this module.

README.txt

SUMMARY

This module provides URL rewrites for integrating Drupal with a Reverse Proxy service. It was developed by the Stanford University Open Source Lab for integrating with the Virtual Host Proxy Service provided by Stanford University ITS.

REQUIREMENTS

The below instructions assume that you have /afs/ir/group/groupname/cgi-bin/drupal as your Drupal installation directory.

  1. Set up a virtual host proxy (http://yourgroup.stanford.edu) to point to your drupal directory:
  • https://www.stanford.edu/group/yourgroup/cgi-bin/drupal
  • Enable the Reverse Proxy module
  • In /afs/ir/group/yourgroup/cgi-bin/drupal/.htaccess, set the RewriteBase variable to /group/yourgroup/cgi-bin/drupal
  • In /afs/ir/group/yourgroup/cgi-bin/sites/default/settings.php set:
    • $base_url = 'http://yourgroup.stanford.edu'; // NO trailing slash!
  • Go to http://yourgroup.stanford.edu to access your site
  • (optional) Create a .htaccess file in /afs/ir/group/yourgroup/WWW/ with the following directives:
    • RewriteEngine on
    • RewriteRule (.*) http://yourgroup.stanford.edu/$1 [R=301,L]