<VirtualHost *:80>
    DocumentRoot /var/www/html/storytelling
    ServerName questit.sfogliaqui.net
    ServerAlias story.internal

    ErrorLog /var/log/apache2/questit.sfogliaqui.net-error.log
    CustomLog /var/log/apache2/questit.sfogliaqui.net-access.log combined
    #LogLevel alert rewrite:trace8

    RewriteEngine On

    RewriteRule . - [E=X_ADA_PRODTYPE:storyTelling]
    RewriteRule . - [E=X_ADA_HTTP_HOST:questit.sfogliaqui.net]

    Header always set Access-Control-Allow-Origin "*"
    Header always set Access-Control-Allow-Credential "true"
    Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
    Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
    Header always set X-Frame-Options "*"
    Header set Cache-Control "max-age=84600, public"

    Alias /img /var/www/html/smssmart/img

    <Directory /var/www/html/storytelling>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>

</VirtualHost>

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        DocumentRoot /var/www/html/storytelling
        ServerName questit.sfogliaqui.net
        ErrorLog ${APACHE_LOG_DIR}/questit.sfogliaqui.net-error.log
        CustomLog ${APACHE_LOG_DIR}/questit.sfogliaqui.net-access.log combined

        <Directory /var/www/html/storytelling>
            Options -Indexes +FollowSymLinks +MultiViews
            AllowOverride All
            Require all granted
        </Directory>

        Header set Access-Control-Allow-Origin "*"
        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateFile /etc/letsencrypt/live/questit.sfogliaqui.net/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/questit.sfogliaqui.net/privkey.pem

    </VirtualHost>
</IfModule>