Issue#41 configure multi proxypass configuration in vhost

This commit is contained in:
sebastien.fleury 2015-03-11 18:28:11 +01:00
parent 93745004ca
commit fce8d72c12
2 changed files with 19 additions and 13 deletions

View File

@ -19,11 +19,7 @@
'CustomLog': site.get('CustomLog', '{0}/{1}-access.log'.format(map.logdir, sitename)), 'CustomLog': site.get('CustomLog', '{0}/{1}-access.log'.format(map.logdir, sitename)),
'ProxyPreserveHost': site.get('ProxyPreserveHost', 'On'), 'ProxyPreserveHost': site.get('ProxyPreserveHost', 'On'),
'ProxyPassSource': site.get('ProxyPassSource', '/'), 'ProxyRoute': site.get('ProxyRoute', {}),
'ProxyPassTarget': site.get('ProxyPassTarget', 'https://{0}'.format(sitename)),
'ProxyPassReverseSource': site.get('ProxyPassReverseSource', site.get('ProxyPassSource', '/')),
'ProxyPassReverseTarget': site.get('ProxyPassReverseTarget', site.get('ProxyPassTarget', 'https://{0}'.format(sitename))),
} %} } %}
<VirtualHost {{ vals.interface }}:{{ vals.port }}> <VirtualHost {{ vals.interface }}:{{ vals.port }}>
@ -39,9 +35,17 @@
{% if site.get('CustomLog') != False %}CustomLog {{ vals.CustomLog }} {{ vals.LogFormat }}{% endif %} {% if site.get('CustomLog') != False %}CustomLog {{ vals.CustomLog }} {{ vals.LogFormat }}{% endif %}
ProxyPreserveHost {{ vals.ProxyPreserveHost }} ProxyPreserveHost {{ vals.ProxyPreserveHost }}
ProxyPass {{ vals.ProxyPassSource }} {{ vals.ProxyPassTarget }} {% for proxy, proxyargs in reverse(vals.ProxyRoute.items()) %}
ProxyPassReverse {{ vals.ProxyPassReverseSource }} {{ vals.ProxyPassReverseTarget }} {% set proxyvals = {
'ProxyPassSource': proxyargs.get('ProxyPassSource', '/'),
'ProxyPassTarget': proxyargs.get('ProxyPassTarget', 'https://{0}'.format(sitename)),
'ProxyPassReverseSource': proxyargs.get('ProxyPassReverseSource', '/'),
'ProxyPassReverseTarget': proxyargs.get('ProxyPassReverseTarget', site.get('ProxyPassTarget', 'https://{0}'.format(sitename))),
} %}
######### {{proxy}} #########
ProxyPass {{ proxyvals.ProxyPassSource }} {{ proxyvals.ProxyPassTarget }}
ProxyPassReverse {{ proxyvals.ProxyPassReverseSource }} {{ proxyvals.ProxyPassReverseTarget }}
{% endfor %}
{% if site.get('Formula_Append') %} {% if site.get('Formula_Append') %}
{{ site.Formula_Append|indent(4) }} {{ site.Formula_Append|indent(4) }}
{% endif %} {% endif %}

View File

@ -63,10 +63,12 @@ apache:
# if template is 'proxy.tmpl' # if template is 'proxy.tmpl'
# ProxyPreserveHost: 'On' # ProxyPreserveHost: 'On'
# ProxyPassSource: '/' # ProxyRoute:
# ProxyPassTarget: 'http://www.example.net' # my sample route:
# ProxyPassReverseSource: '/' # ProxyPassSource: '/'
# ProxyPassReverseTarget: 'http://www.example.net' # ProxyPassTarget: 'http://www.example.net'
# ProxyPassReverseSource: '/'
# ProxyPassReverseTarget: 'http://www.example.net'
Formula_Append: | Formula_Append: |
Additional config as a Additional config as a