Reverse proxy best practices

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
flapsjack's picture

We have a site that is being built that will be a site-wide cms for the University I work at. The way it will work is the following:

The existing setup is just Apache serving static pages. These will be migrated into a single Drupal instance and not individual Drupal multisites. So it is now universityurl.edu/chemistry that serves the static content. Ideally, the same site can be recreated at cms.universityurl.edu/chemistry in Drupal, and once the chemistry department is happy with the new version, I can flip a switch (.htaccess or apache change), and universityurl.edu/chemistry is now being reverse proxied to cms.universityurl.edu/chemistry.

I have gotten this working using mod_rewrite rules and the [P] flag which can be placed in a .htaccess file. In order for my reverse proxied site's urls to be correct, I have set the base_url of the Drupal site to match where it is being reverse proxied from (universityurl.edu/chemistry). Again, this is working. The problem is that biology and many other departments now are being brought into the cms as well and the base_url is specific to chemistry. I can have some php code in settings.php to change the base_url as needed, but this doesn't seem correct to me.

Am I doing something wrong? Is there a better technique to reverse proxy multiple directories to a single Drupal cms on demand? Also, this solution needs to be flexible because the University home page will probably become part of the cms as well in the future. I want to make sure I don't use something that will be difficult or impossible to work with in the future.

Thanks and feel free to ask for additional clarification or other questions.