# Advanced Configuration

# Reverse Proxy

The TS3 Manager is only accessible over HTTP. To make the app available over HTTPS you need to set up a reverse proxy (e.g. Apache or NGINX). There are tons of guides on the internet how to setup a reverse proxy with free ssl certificate. Below are just example vhost/server block files for Apache and NGINX. Pay attention if the websocket connection is handled properly. Otherwise the app will be using long-polling via AJAX as fallback, which is less efficient than websockets. You will see the following error in the console of your browser:

WARNING

websocket.js:118 WebSocket connection to 'ws://10.10.10.129/socket.io/?EIO=3&transport=websocket&sid=XP3rQc_TVKoAjpWFAAAG' failed: Error during WebSocket handshake: Unexpected response code: 400

# Apache

<IfModule mod_ssl.c>
  <VirtualHost *:443>
    ServerName ts3-manager.example.com
    ServerAdmin webmaster@example.com

    # Reverse Proxy enabled. See https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html
    ProxyPass "/" "http://127.0.0.1:3000/"
    ProxyPassReverse "/" "http://127.0.0.1:3000/"

    # Rules for handling websockets behind the proxy
    RewriteEngine On
    RewriteCond %{REQUEST_URI}  ^/socket.io            [NC]
    RewriteCond %{QUERY_STRING} transport=websocket    [NC]
    RewriteRule /(.*)           ws://127.0.0.1:3000%{REQUEST_URI} [P,L]

    # Certificates
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/ts3-manager.example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/ts3-manager.example.com/privkey.pem
  </VirtualHost>
</IfModule>

# NGINX

server {
        # Suggest using ssl, setup is pretty easy using certbot: https://certbot.eff.org/
        listen [::]:443 ssl;
        listen 443 ssl;
        # Without ssl use those
        #listen [::]:80;
        #listen 80;

        server_name ts3.example.com;

        proxy_set_header X-Forwarded-For $remote_addr;

        # Optional: Use additional Basic Auth to protect the app and teamspeak a bit more from attacks. Instructions: https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/
        #auth_basic "TS3 Manager";
        #auth_basic_user_file /var/www/ts3-manager/ts3.example.com/.htpasswd;

        location / {
                # Insert the port you selected in systemd service unit above
                proxy_pass http://127.0.0.1:8080;
        }

        # Let certbot install certificates for you or remove those if you don't use ssl
        ssl_certificate /etc/letsencrypt/live/ts3.example.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/ts3.example.com/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

Thanks to dionysius (opens new window), who provided the nginx config. (#11 (opens new window))

# Compile Your Own Executable

# Prequirements

The whole app is written in Node.js (opens new window). Download and install Node.js version >16 on your system.

# Step by step

  1. Clone the Github repository (opens new window) via Git (opens new window) or download the repository as a zip file from the github webpage.
git clone https://github.com/joni1802/ts3-manager.git
  1. Install the dependencies.
cd ts3-manager

npm install
  1. Build the executable file.
npm run build
  1. An executeable file with the name server(.exe) should now exist in the server directory ./packages/server/. Optionally rename the file and set the correct permissions (linux and macos).
chmod +x ./server
  1. Run the executable file.
./server