<VirtualHost *:80>
    ServerName cloud.lencraftserver.de

    DocumentRoot /var/www/datanet

    Alias /.well-known/acme-challenge/ /var/www/datanet/.well-known/acme-challenge/
    <Directory "/var/www/datanet/.well-known/acme-challenge/">
        Options None
        AllowOverride None
        Require all granted
    </Directory>

    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName cloud.lencraftserver.de


    SetEnvIf Request_URI "^/health$" dontlog

    CustomLog ${APACHE_LOG_DIR}/access.log combined env=!dontlog
    ErrorLog ${APACHE_LOG_DIR}/error.log

    <Directory "/var/www/datanet/.well-known/acme-challenge/">
        Options None
        AllowOverride None
        Require all granted
    </Directory>

    ProxyPreserveHost On
    ProxyPass / http://localhost:1025/ retry=0
    ProxyPassReverse / http://localhost1025/

    <Location />
        Header always set Access-Control-Allow-Origin "*"
        Header always set Access-Control-Allow-Methods "GET, OPTIONS"
        Header always set Access-Control-Allow-Headers "Content-Type, Authorization"
    </Location>

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/cloud.lencraftserver.de/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/cloud.lencraftserver.de/privkey.pem
</VirtualHost>
</IfModule>

