<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin webmaster@spaceboard.app
    ServerName spaceboard.app
    ServerAlias www.spaceboard.app
    
    # Only proxy to backend API
    ProxyRequests Off
    ProxyPreserveHost On
    
    <Location /api>
        ProxyPass http://localhost:5000/api
        ProxyPassReverse http://localhost:5000/api
    </Location>
    
    # Serve frontend directly from Node.js
    <Location />
        ProxyPass http://localhost:3000/
        ProxyPassReverse http://localhost:3000/
    </Location>
    
    ErrorLog ${APACHE_LOG_DIR}/spaceboard.app-error.log
    CustomLog ${APACHE_LOG_DIR}/spaceboard.app-access.log combined
    
    SSLCertificateFile /etc/letsencrypt/live/spaceboard.app/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/spaceboard.app/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
