# Apache 2 Reverse proxy config for affine.pro selhosted

Need install module:

a2enmod proxy_http proxy proxy_wstunnel

<VirtualHost *:443>

        ProxyPreserveHost On
        ProxyRequests Off
        ServerName domaine.example.com
        ServerAlias domaine2.example.com
        ProxyPass / http://localhost:3010/
        ProxyPassReverse / http://localhost:3010/

        ServerAdmin webmaster@localhost

        RewriteEngine On
        RewriteCond %{REQUEST_URI}  ^/socket.io            [NC]
        RewriteCond %{QUERY_STRING} transport=websocket    [NC]
        RewriteRule /(.*)           ws://localhost:3010/$1 [P,L]

       
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        
        SSLEngine on


        SSLCertificateFile      /etc/letsencrypt/live/domaine.example.com/fullchain.pem
        SSLCertificateKeyFile   /etc/letsencrypt/live/domaine.example.com/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
        Header always set Strict-Transport-Security "max-age=31536000"
        SSLUseStapling on
</VirtualHost>