Question: How to define custom location block (e.g. /.ghost/*) via Traefik instead of Caddy?

Ok so the above worked well for my demo site + new selfhosted activitypub service.

Also confirmed this works pointed to ap.ghost.org. To do this in coolify I added the following dynamic config to traefik proxy as a file named activitypub.yaml

http:
  routers:
    activitypub-ghost:
      rule: 'Host(`example-ghost-site.com`) && PathPrefix(`/.ghost/activitypub`)'
      service: ap-ghost-external
      entryPoints:
        - https
      priority: 500
      tls:
        certResolver: letsencrypt
    activitypub-webfinger:
      rule: 'Host(`example-ghost-site.com`) && Path(`/.well-known/webfinger`)'
      service: ap-ghost-external
      entryPoints:
        - https
      priority: 500
      tls:
        certResolver: letsencrypt
    activitypub-nodeinfo:
      rule: 'Host(`example-ghost-site.com`) && Path(`/.well-known/nodeinfo`)'
      service: ap-ghost-external
      entryPoints:
        - https
      priority: 500
      tls:
        certResolver: letsencrypt
  services:
    ap-ghost-external:
      loadBalancer:
        servers:
          -
            url: 'https://ap.ghost.org'
        passHostHeader: true

And finally, I attached the dynamic config to my existing ghost server:

labels:
  - "traefik.http.routers.ghost.middlewares=activitypub@file"

Notes:

  • The activitypub table had to be manually created, migration wouldn’t work prior to that.
    • If I did selfhost, I’d probably setup activitypub as a separate instance with either it’s own mysql or the one serving my ghost sites.
2 Likes