#uuuuuuuu
# Virtual Hosts
#1111111111111
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
#NameVirtualHost *:80
#Test01
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
    ServerName oa.test.com

    ProxyPass /synchrony http://10.5.0.90:8091/synchrony
    ProxyPassReverse  /synchrony  http://10.5.0.90:8091/synchrony

    <Location  /synchrony>
        Require all granted
        RewriteEngine on
        RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
        RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
        RewriteRule .* ws://10.5.0.90:8091%{REQUEST_URI} [P]
    </Location>

    Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED

    <Proxy balancer://confluence>
    BalancerMember  http://10.5.0.90:8090/confluence  route=90
    BalancerMember  http://10.5.0.91:8090/confluence  route=91
    BalancerMember  http://10.5.0.92:8090/confluence  route=92
    ProxySet lbmethod=byrequests
    ProxySet stickysession=ROUTEID
    </Proxy>

    ProxyPass   /confluence  balancer://confluence
    ProxyPassReverse  /confluence  balancer://confluence

    DirectoryIndex portal
    ErrorLog "|/usr/sbin/rotatelogs /etc/httpd/logs/oa.test.com_%Y_%m_%d_error.log 86400 +480"
    #CustomLog logs/oa.test.com-access.log common
    CustomLog "|/usr/sbin/rotatelogs /etc/httpd/logs/oa.test.com_%Y_%m_%d_access.log 86400 +480" common
    #Proxyrequests on
</VirtualHost>


#NameVirtualHost *:443
SSLStrictSNIVHostCheck off
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:443>
    ServerName oa.test.com


    <Proxy *>
        Require all granted
    </Proxy>

    ProxyPass /synchrony http://10.5.0.90:8091/synchrony
    ProxyPassReverse  /synchrony  http://10.5.0.90:8091/synchrony

    <Location /synchrony>
        Require all granted
        RewriteEngine on
        RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
        RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
        RewriteRule .* ws://10.5.0.90:8091%{REQUEST_URI} [P]
    </Location>

    <Location />
        Require all granted
    </Location>

    #<Location "/balancer-manager">
    #SetHandler balancer-manager
    #Require host 10.186.100.253
    #</Location>

    Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED

    <Proxy balancer://confluence>
    BalancerMember  http://10.5.0.90:8090/confluence  route=90
    BalancerMember  http://10.5.0.91:8090/confluence  route=91
    BalancerMember  http://10.5.0.92:8090/confluence  route=92
    ProxySet lbmethod=byrequests
    ProxySet stickysession=ROUTEID
    </Proxy>

    ProxyPass   /confluence  balancer://confluence
    ProxyPassReverse  /confluence  balancer://confluence
   
    DirectoryIndex portal
    ErrorLog "|/usr/sbin/rotatelogs /etc/httpd/logs/oa.test.com_%Y_%m_%d_ssl_error01.log 86400 +480"
    LogFormat "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x  \"%{Host}i\" \"%r\" %>s %b" ssl_request_format
    CustomLog "|/usr/sbin/rotatelogs /etc/httpd/logs/oa.test.com_%Y_%m_%d_ssl_request02.log 86400 +480" ssl_request_format

   SSLEngine on
   SSLProxyEngine on
   ProxyRequests Off
   <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>
   SSLCertificateChainFile /etc/httpd/conf/ca.crt
   SSLCertificateFile /etc/httpd/conf/server.crt
   SSLCertificateKeyFile /etc/httpd/conf/server.key
</VirtualHost>



