<VirtualHost *:80>
    ServerName gitlab._VAR_DOMAIN
    DocumentRoot /srv/www

    RewriteEngine On
    RewriteRule ^/?\.well-known/acme-challenge - [L]
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

    ErrorLog ${APACHE_LOG_DIR}/gitlab-error.log
    CustomLog ${APACHE_LOG_DIR}/gitlab-access.log combined
</VirtualHost>

<VirtualHost *:443>
    ServerName gitlab._VAR_DOMAIN
    Protocols h2 http/1.1
    DocumentRoot /srv/www

    SSLEngine on
    SSLCertificateFile /etc/ssl/acme-sh/gitlab._VAR_DOMAIN.pem
    SSLCertificateKeyFile /etc/ssl/acme-sh/gitlab._VAR_DOMAIN.key
    Header always add Strict-Transport-Security "max-age=15768000"

    AllowEncodedSlashes NoDecode
    ProxyPass / http://127.0.0.1:8802/ nocanon
    ProxyPreserveHost on
    RequestHeader set X-Forwarded-Proto "https"
    RequestHeader set X-Forwarded-Port "443"

    ErrorLog ${APACHE_LOG_DIR}/gitlab-error.log
    CustomLog ${APACHE_LOG_DIR}/gitlab-access.log combined
</VirtualHost>
