<VirtualHost your-part.de:80>
    ServerAdmin webmaster@your-part.de
    ServerName your-part.de
    ServerAlias www.your-part.de

    DocumentRoot /opt/yourpart/frontend/dist

    DirectoryIndex index.html

    # Frontend statische Dateien
    <Directory "/opt/yourpart/frontend/dist">
        AllowOverride None
        Options -Indexes +FollowSymLinks
        Require all granted
        
        # Fallback für Vue Router
        FallbackResource /index.html
    </Directory>

    # API-Requests an Backend weiterleiten
    ProxyPass "/api/" "http://localhost:2020/api/"
    ProxyPassReverse "/api/" "http://localhost:2020/api/"
    
    # WebSocket-Requests an Backend weiterleiten
    ProxyPass "/socket.io/" "http://localhost:2020/socket.io/"
    ProxyPassReverse "/socket.io/" "http://localhost:2020/socket.io/"

    ErrorLog /var/log/apache2/yourpart.error.log
    CustomLog /var/log/apache2/yourpart.access.log combined

    HostnameLookups Off
    UseCanonicalName Off
    ServerSignature On

    # SSL Redirect
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =www.your-part.de [OR]
    RewriteCond %{SERVER_NAME} =your-part.de
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
