Reverse Proxy
Putting Tramola behind nginx or Apache, so it is reached over https on a normal port.
Tramola serves plain http on port 3471 and does not terminate TLS itself. For anything beyond a machine you are the only user of, put a reverse proxy in front of it: the proxy holds the certificate, listens on 443, and passes requests through.
There are four things such a setup has to get right. Skip them and everything appears to work until something specific breaks.
| Must | Why |
|---|---|
| Pass WebSocket upgrades through | Runners connect over a WebSocket. Without it, jobs are never dispatched — the interface looks fine and nothing ever runs. |
| Allow large request bodies | Scenario and run files are uploaded through the proxy. Tramola itself accepts up to 1 GB. |
| Generous timeouts | Some requests take a long time to answer. |
X-Forwarded-Proto |
How Tramola knows the request arrived over https, which is what governs the HSTS header. |
nginx Link to this section
server {
listen 443 ssl;
server_name tramola.example.com;
ssl_certificate /etc/letsencrypt/live/tramola.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/tramola.example.com/privkey.pem;
# uploads: Tramola itself accepts up to 1 GB
client_max_body_size 1000m;
location / {
proxy_pass http://127.0.0.1:3471;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# runners connect over a WebSocket; without these two the connection is refused
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_send_timeout 300s;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
}
}
server {
listen 80;
server_name tramola.example.com;
return 301 https://$host$request_uri;
}
Apache Link to this section
ServerName tramola.example.com
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/tramola.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/tramola.example.com/privkey.pem
# needs mod_proxy, mod_proxy_http, mod_proxy_wstunnel and mod_headers
ProxyPreserveHost On
RequestHeader set X-Forwarded-Proto "https"
# WebSocket first: the runner connection, which must not fall through to the http handler
ProxyPass /api/v1/jobs/ws/ ws://127.0.0.1:3471/api/v1/jobs/ws/
ProxyPassReverse /api/v1/jobs/ws/ ws://127.0.0.1:3471/api/v1/jobs/ws/
ProxyPass / http://127.0.0.1:3471/
ProxyPassReverse / http://127.0.0.1:3471/
ProxyTimeout 300
Then set the public url Link to this section
The proxy changes the address people reach Tramola at, and Tramola has to be told — it is what goes into the links it mails out:
tramola.publicUrl = "https://tramola.example.com"
See Security and TLS for this and for the HSTS setting, which only takes effect once requests actually arrive over https.
Close the direct route Link to this section
With the proxy on the same machine, stop anything reaching Tramola around it:
tramola.localhostOnly = true
Tramola then binds to localhost only, and port 3471 is unreachable from elsewhere. Do this after the proxy works, not before.
Two things the proxy does not cover Link to this section
SFTP. The file server is a separate port (2222 by default), speaking SSH rather than http. A web proxy does nothing for it: open the port in the firewall, or switch the service off. See File Server.
Per-address rate limiting, if the proxy is on another host. Tramola trusts forwarding
headers only from a connection arriving over loopback — otherwise anybody could name their own
address. With the proxy on a different machine, the headers are ignored and every request
looks like it came from the proxy, so all users share one address budget for failed sign-ins.
Set maxFailuresPerAddress = 0 in that case; see
Login and Sessions.