This is a quick tutorial that will cover how to setup a virtual server that uses Caddy to proxy HTTPS for Foundry.
Please note that using a proxy server like Caddy, while advantageous for dedicated web hosts, is absolutely not required in order to use Foundry Virtual Tabletop.
Step 1 - Create your Virtual Host
While setting up a virtual server to host Foundry is outside the scope of this tutorial, a few helpful pointers will be included. There are quite a few inexpensive hosting providers available such as:
Foundry doesn't require many resources on the server side as most of the processing happens within the client's browser, so the typical $5/month (or lower) plan should be plenty. If you went with Linode, here is a tutorial you can follow to get your instance created and setup.
Step 2 - Install Caddy
Caddy is a web server, similar to Nginx or Apache. However it focuses more on being able to easily setup an HTTPS Proxy. Recently version 2 of Caddy was released and so you will likely want to use that version. You can find instructions for installing it on the more popular distributions below. If you're using a something different, please follow the Caddy install guide.
This guide assumes a basic level of familiarity with the Linux operating system and how to interface with it. If you are brand new to Linux we recommend starting with a beginner's tutorial to the Linux command line before proceeding.
$ sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
$ curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -
$ curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list
$ sudo apt update
$ sudo apt install caddy
$ dnf install 'dnf-command(copr)'
$ dnf copr enable @caddy/caddy
$ dnf install caddy
$ yum install yum-plugin-copr
$ yum copr enable @caddy/caddy
$ yum install caddy
Step 3 - Configure Caddy
Caddy will come with a default configuration that will set it up as a simple web server. You'll need to update that configuration to use it as a reverse proxy.
Make sure to update the references to your.hostname.com
in the configuration. Without a proper hostname, Caddy will fail to automatically install an SSL certificate from Let's Encrypt. If you don't have your own domain, you can use the dynamic hostname assigned by your hosting provider.
# This replaces the existing content in /etc/caddy/Caddyfile
# A CONFIG SECTION FOR YOUR HOSTNAME
your.hostname.com {
# PROXY ALL REQUEST TO PORT 30000
reverse_proxy localhost:30000
}
# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile
Once you have configured Caddy, there are some configurations for Foundry Virtual Tabletop in the Application Configuration article you will also want to apply. Set the following options in your Foundry VTT{userData}/Config/options.json
file which will instruct Foundry that the server is running with a proxy server in front of it on port 443.
Please be aware that if your Foundry VTT location is hosted at a subfolder location, such as mysite.com/foundryvtt
, you will need to define a routePrefix as outlined in the Application Configuration article.
"hostname": "your.hostname.com",
"routePrefix": null,
"sslCert": null,
"sslKey": null,
"port": 30000,
"proxyPort": 443,
"proxySSL": true
Once you have configured your reverse proxy, you will want to restart the proxy instance as well as your Foundry VTT instance to ensure that the new settings are active.
Step 4 - Caddy Administration
You can use the service
utility to easily manage your Caddy server.
# Check Status
sudo service caddy status
# Start Caddy
sudo service caddy start
# Stop Caddy
sudo service caddy stop
# Restart Caddy
sudo service caddy restart
If you have followed these steps you should now be running an SSL reverse proxy redirecting traffic to Foundry VTT, enjoy!