Setting a custom homepage on a PDS

I saw a post about it being the rules to make your PDS homepage spooky, so I decided to have a go at doing so.

I did a bit of Googling and read the Caddy docs and discovered you can have a fileserver with a default index page (either index.html or index.txt)

First I needed to update my Caddyfile to serve the fileserver only on the / route of my PDS config. That ended up looking like this.

*.willdot.xyz, willdot.xyz {
tls {
on_demand
}
@not-home {
not path /
}
reverse_proxy @not-home http://pds:3000
root * /srv/static
file_server
}

This directs Caddy to redirect anything that is NOT the path / to the normal reverse proxy and anything else (/ in this case) to a file server where the root of that file server is /srv/static

We then need to get a file inside that /srv/static directory inside the Caddy container, so to do that I created a index.txt file which contained my spooky text and placed that inside /pds/caddy/static (static was a new directory I created) on my server.

Next I created a new volume for the Caddy container in my docker-compose.yaml file for my PDS which meant it looked like this (see the new volume bind):

services:
caddy:
container_name: caddy
image: caddy:2
depends_on:
- pds
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- type: bind
source: /pds/caddy/data
target: /data
- type: bind
source: /pds/caddy/etc/caddy
target: /etc/caddy
- type: bind
source: /pds/caddy/static
target: /srv/static

Once that was done, I ran a docker compose up -d to get things restarted and tested it out. Hopefully I didn't miss anything. Please be careful and always back up the files before editing. It's super easy to revert back to the backups and restart the services should you make a mistake :)