{
  "path": "/3m25uvnuwnk2t",
  "site": "at://did:plc:dadhhalkfcq3gucaq25hjqon/site.standard.publication/3lzrigh3cl22p",
  "$type": "site.standard.document",
  "title": "Setting a custom homepage on a PDS",
  "content": {
    "$type": "pub.leaflet.content",
    "pages": [
      {
        "$type": "pub.leaflet.pages.linearDocument",
        "blocks": [
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": "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."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.bskyPost",
              "postRef": {
                "cid": "bafyreiazklluozfqbdzypx4im3kqzxgrirdg6fhopsuw32hq3t2dlpmv5q",
                "uri": "at://did:plc:qttsv4e7pu2jl3ilanfgc3zn/app.bsky.feed.post/3m25aetpm4c2b"
              }
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": ""
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": "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)"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": ""
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "index": {
                    "byteEnd": 75,
                    "byteStart": 74
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                }
              ],
              "plaintext": "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."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "plaintext": "*.willdot.xyz, willdot.xyz {\n        tls {\n                on_demand\n        }\n        @not-home {\n                not path /\n        }\n        reverse_proxy @not-home http://pds:3000\n        root * /srv/static\n        file_server\n}"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "index": {
                    "byteEnd": 62,
                    "byteStart": 61
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                },
                {
                  "index": {
                    "byteEnd": 111,
                    "byteStart": 110
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                },
                {
                  "index": {
                    "byteEnd": 192,
                    "byteStart": 181
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                }
              ],
              "plaintext": "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"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "index": {
                    "byteEnd": 50,
                    "byteStart": 39
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                },
                {
                  "index": {
                    "byteEnd": 124,
                    "byteStart": 115
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                },
                {
                  "index": {
                    "byteEnd": 201,
                    "byteStart": 184
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                }
              ],
              "plaintext": "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. "
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": "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):"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "plaintext": "services:\n  caddy:\n    container_name: caddy\n    image: caddy:2\n    depends_on:\n      - pds\n    restart: unless-stopped\n    ports:\n      - \"80:80\"\n      - \"443:443\"\n      - \"443:443/udp\"\n    volumes:\n      - type: bind\n        source: /pds/caddy/data\n        target: /data\n      - type: bind\n        source: /pds/caddy/etc/caddy\n        target: /etc/caddy\n      - type: bind\n        source: /pds/caddy/static\n        target: /srv/static"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": ""
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "index": {
                    "byteEnd": 48,
                    "byteStart": 28
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                }
              ],
              "plaintext": "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 :) "
            }
          }
        ]
      }
    ]
  },
  "bskyPostRef": {
    "cid": "bafyreifwlzwmunz3w5ovkngndk5kdewqiiajb5y3sfbnuh7kpxsyy7nlki",
    "uri": "at://did:plc:dadhhalkfcq3gucaq25hjqon/app.bsky.feed.post/3m25uvsrckk2t",
    "commit": {
      "cid": "bafyreiaupwazlsadnhl67fxz6feptqrejkeemzkhf7qwekk46ojhzyg7de",
      "rev": "3m25uvsw7rs2i"
    },
    "validationStatus": "valid"
  },
  "description": "A quick and dirty way to set a custom homepage on your PDS",
  "publishedAt": "2025-10-01T20:28:47.718Z"
}