<VirtualHost *:80>
    ServerName graphiti.zulip.net
    Redirect permanent / https://graphiti.zulip.net/
</VirtualHost>


<VirtualHost *:443>
    ServerName graphiti.zulip.net

    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/stats1.zulip.net.crt
    SSLCertificateKeyFile /etc/ssl/certs/stats1.zulip.net.key

    Header add Strict-Transport-Security "max-age=15768000"
    Header add X-Frame-Options DENY

    <Location "/">
        AuthType Digest
        AuthName "wiki"
        AuthDigestProvider file
        AuthUserFile /etc/apache2/users/wiki
        Require valid-user
    </Location>

    # Graphiti reverse-proxy to unicorn serving at localhost:8088

    ProxyRequests Off
    ProxyPreserveHost On

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass / http://127.0.0.1:8088/
    ProxyPassReverse / http://127.0.0.1:8088/

    ErrorLog /var/log/apache2/error.log
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined
    ServerSignature On
</VirtualHost>
