{% set TRUE_VALUES = ['y', 'yes', '1', 'true'] -%}
# Only accept generic (i.e not Zope) backends on http
<VirtualHost *:{{ cached_port }}>
  ServerName {{ slave_parameter.get('custom_domain') }}
  SSLProxyEngine on

{% set ssl_proxy_verify = ('' ~ slave_parameter.get('ssl-proxy-verify', '')).lower() in TRUE_VALUES -%}
{% if ssl_proxy_verify -%}
{%   if 'ssl_proxy_ca_crt' in slave_parameter -%}
  SSLProxyCACertificateFile {{ slave_parameter.get('path_to_ssl_proxy_ca_crt', '') }}
{%   endif %}
  SSLProxyVerify require
  #SSLProxyCheckPeerCN on
  SSLProxyCheckPeerExpire on
{% endif %}
  # Rewrite part
  ProxyPreserveHost On
  ProxyTimeout 600
  RewriteEngine On

  RewriteRule ^/(.*)$ {{ slave_parameter.get('backend_url', '') }}/$1 [L,P]

</VirtualHost>