From a827227079d380def59e6c93255eeb0cf77ffd12 Mon Sep 17 00:00:00 2001
From: Clint Adams <clint@gcfm.net>
Date: Tue, 6 Oct 2015 15:57:14 -0400
Subject: [PATCH] Allow specification of DocumentRoot when reverse-proxying
 partially

If any locations are being excluded from reverse-proxying, we need
to be able to specify a DocumentRoot to serve up un-proxied files.

Change-Id: I1c5fe6f73b5983886578975e89c5e4148b506795
---
 manifests/vhost/proxy.pp       | 1 +
 templates/vhost-proxy.conf.erb | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/manifests/vhost/proxy.pp b/manifests/vhost/proxy.pp
index 86d5622..d0b699c 100644
--- a/manifests/vhost/proxy.pp
+++ b/manifests/vhost/proxy.pp
@@ -28,6 +28,7 @@ define httpd::vhost::proxy (
     $ssl           = false,
     $vhost_name    = '*',
     $proxyexclusions = undef,
+    $docroot       = undef,
   ) {
 
   include ::httpd
diff --git a/templates/vhost-proxy.conf.erb b/templates/vhost-proxy.conf.erb
index f275775..b81f7dd 100644
--- a/templates/vhost-proxy.conf.erb
+++ b/templates/vhost-proxy.conf.erb
@@ -26,6 +26,9 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
    ProxyPassReverse / <%= @dest %>/
    ProxyPreserveHost On 
 
+<% if @proxyexclusions != nil and @docroot != nil %>
+   DocumentRoot <%= @docroot %>
+<% end %>
    ErrorLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= @name %>_error.log
    LogLevel warn
    CustomLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= @name %>_access.log combined