<VirtualHost *:80>
    ServerName gateway.truthtide.tv

    Redirect permanent / https://gateway.truthtide.tv/

    ErrorLog ${APACHE_LOG_DIR}/stripe_gateway_error.log
    CustomLog ${APACHE_LOG_DIR}/stripe_gateway_access.log combined
</VirtualHost>

<VirtualHost *:443>
    ServerName gateway.truthtide.tv

    ProxyPass / unix:/var/www/html/stripe-gateway/stripe_gateway.sock|http://gateway.truthtide.tv/
    ProxyPassReverse / unix:/var/www/html/stripe-gateway/stripe_gateway.sock|http://gateway.truthtide.tv/

    Header set Access-Control-Allow-Origin "http://localhost:3000"
    Header set Access-Control-Allow-Methods "GET, POST, OPTIONS"
    Header set Access-Control-Allow-Headers "Content-Type, Authorization"
    Header set Access-Control-Allow-Credentials "true"

    # SSL configuration
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/conspyre.news-0003/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/conspyre.news-0003/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/conspyre.news-0003/chain.pem

    ErrorLog ${APACHE_LOG_DIR}/stripe_gateway_error.log
    CustomLog ${APACHE_LOG_DIR}/stripe_gateway_access.log combined
</VirtualHost>

