#
# Apache configuration for reverse proxy.
#
ServerName authen.doc

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
LoadModule proxy_http_module modules/mod_proxy_http.so

<Proxy balancer://backend>
    BalancerMember http://auth-svc1.doc:3001
    BalancerMember http://auth-svc2.doc:3002
    ProxySet lbmethod=byrequests
</Proxy>

<VirtualHost *:443>
    SSLEngine on
    SSLCertificateFile /usr/local/apache2/conf/server.crt
    SSLCertificateKeyFile /usr/local/apache2/conf/server.key
    SSLProxyEngine On

    # Set a timeout longer than the service's own timeout period,
    # otherwise Apache will return a 502 instead of the expected 408.
    ProxyPass / balancer://backend/ timeout=75
    ProxyPassReverse / balancer://backend/
    RequestHeader set X-Forwarded-Proto "https"
</VirtualHost>
