ProxyRequests Off

# HTTP Redirects
<VirtualHost *:80>
    ServerName ceruleanrecordings.com
    ServerAlias www.ceruleanrecordings.com
    Redirect permanent / https://ceruleanrecordings.com/
</VirtualHost>

<VirtualHost *:80>
    ServerName miketv.org
    ServerAlias www.miketv.org
    Redirect permanent / https://miketv.org/
</VirtualHost>

# HTTPS - ceruleanrecordings.com
<VirtualHost *:443>
    ServerName ceruleanrecordings.com
    ServerAlias www.ceruleanrecordings.com
    DocumentRoot /var/www/html

    SSLEngine on
    SSLCertificateFile    /etc/ssl/ceruleanrecordings.com/chained.pem
    SSLCertificateKeyFile /etc/ssl/ceruleanrecordings.com/domain.key
    SSLCertificateChainFile /etc/ssl/ceruleanrecordings.com/chained.pem
    SSLProtocol TLSv1.2 TLSv1.3
    SSLCipherSuite ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
    SSLHonorCipherOrder on

    <Directory /var/www/html>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/cerulean_error.log
    CustomLog ${APACHE_LOG_DIR}/cerulean_access.log combined
</VirtualHost>

# HTTPS - miketv.org
<VirtualHost *:443>
    ServerName miketv.org
    ServerAlias www.miketv.org

    SSLEngine on
    SSLCertificateFile    /etc/ssl/miketv.org/chained.pem
    SSLCertificateKeyFile /etc/ssl/miketv.org/domain.key
    SSLCertificateChainFile /etc/ssl/miketv.org/chained.pem
    SSLProtocol TLSv1.2 TLSv1.3
    SSLCipherSuite ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
    SSLHonorCipherOrder on

    # Proxy only API requests to the Docker container
    ProxyPreserveHost On
    ProxyPass /api/ http://miketeavee-api:3000/
    ProxyPassReverse /api/ http://miketeavee-api:3000/

    <Proxy *>
        Require all granted
    </Proxy>

    DocumentRoot /var/www/html/mtvapi

    <Directory /var/www/html/mtvapi>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/mtv_error.log
    CustomLog ${APACHE_LOG_DIR}/mtv_access.log combined
</VirtualHost>
