<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName eta.vbarco.com.br

    DocumentRoot /var/www/html/ETA

    # Habilitar proxy
    ProxyPreserveHost On
    ProxyRequests Off

    # WebSocket endpoint - DEVE vir ANTES de outras regras
    <Location /ws>
        ProxyPass ws://localhost:8081/ws
        ProxyPassReverse ws://localhost:8081/ws
    </Location>

    # Health check endpoint
    ProxyPass /health http://localhost:8081/health
    ProxyPassReverse /health http://localhost:8081/health

    # Logs
    ErrorLog ${APACHE_LOG_DIR}/eta-vbarco-error.log
    CustomLog ${APACHE_LOG_DIR}/eta-vbarco-access.log combined

SSLCertificateFile /etc/letsencrypt/live/eta.vbarco.com.br/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/eta.vbarco.com.br/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
