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

**URL:** <https://forum.ghost.org/t/question-how-to-define-custom-location-block-e-g-ghost-via-traefik-instead-of-caddy/58996>\
**Category:** Self-hosting\
**Created:** [July 24, 2025, 8:34pm UTC](https://forum.ghost.org/t/question-how-to-define-custom-location-block-e-g-ghost-via-traefik-instead-of-caddy/58996 "2025-07-24T20:34:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![eddywashere](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/eddywashere/32/33436_2.png) [@eddywashere](https://forum.ghost.org/u/eddywashere)\
**Post date:** [July 24, 2025, 8:34pm UTC](https://forum.ghost.org/t/question-how-to-define-custom-location-block-e-g-ghost-via-traefik-instead-of-caddy/58996/1 "2025-07-24T20:34:29Z")

</div>

Hey y’all — excited to be testing the new Ghost Docker setup!

I understand there are happy paths to prioritize so **please** ignore this unless you happen to know the fix or can point me in a good direction.

Background: I am coming from an existing setup in Coolify which uses **Traefik** as the reverse proxy (it can do caddy, but I’d like to stick with Traefik if possible). Prior to Traefik + Coolify, I was using nginx to expose Ghost and pass through requests to my selfhosted activitypub service via a custom nginx location block.

I have not yet figured out the magic traefik dynamic configuration file to manually add or traefik labels to apply to my coolify compose file.

Anyone have suggestions or examples on how to set up a path-based route for the proxied request in this new setup in Traefik? For selfhosted activity pub service or the hosted [ap.ghost.org](http://ap.ghost.org)?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![eddywashere](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/eddywashere/32/33436_2.png) [@eddywashere](https://forum.ghost.org/u/eddywashere)\
**Post date:** [July 24, 2025, 9:13pm UTC](https://forum.ghost.org/t/question-how-to-define-custom-location-block-e-g-ghost-via-traefik-instead-of-caddy/58996/2 "2025-07-24T21:13:27Z")

</div>

Figured it out and it works! Added the following labels to my ghost service and cleared my cache in chrome (right-click refresh button).

```auto
labels:
      # Local ActivityPub service definition
      - "traefik.http.services.activitypub-local.loadbalancer.server.port=8080"
      
      # Main ActivityPub router - simple passthrough
      - "traefik.http.routers.activitypub-ghost.rule=Host(`$SERVICE_FQDN_GHOST_2368`) && PathPrefix(`/.ghost/activitypub`)"
      - "traefik.http.routers.activitypub-ghost.priority=300"
      - "traefik.http.routers.activitypub-ghost.service=activitypub-local"
      - "traefik.http.routers.activitypub-ghost.entrypoints=https"
      - "traefik.http.routers.activitypub-ghost.tls=true"
      - "traefik.http.routers.activitypub-ghost.tls.certresolver=letsencrypt"
      
      - "traefik.http.routers.activitypub-webfinger.rule=Host(`$SERVICE_FQDN_GHOST_2368`) && Path(`/.well-known/webfinger`)"
      - "traefik.http.routers.activitypub-webfinger.priority=300"
      - "traefik.http.routers.activitypub-webfinger.service=activitypub-local"
      - "traefik.http.routers.activitypub-webfinger.entrypoints=https"
      - "traefik.http.routers.activitypub-webfinger.tls=true"
      - "traefik.http.routers.activitypub-webfinger.tls.certresolver=letsencrypt"
      
      - "traefik.http.routers.activitypub-nodeinfo.rule=Host(`$SERVICE_FQDN_GHOST_2368`) && Path(`/.well-known/nodeinfo`)"
      - "traefik.http.routers.activitypub-nodeinfo.priority=300"
      - "traefik.http.routers.activitypub-nodeinfo.service=activitypub-local"
      - "traefik.http.routers.activitypub-nodeinfo.entrypoints=https"
      - "traefik.http.routers.activitypub-nodeinfo.tls=true"
      - "traefik.http.routers.activitypub-nodeinfo.tls.certresolver=letsencrypt"

```

---

<div class="post-metadata">

**Author:** ![eddywashere](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/eddywashere/32/33436_2.png) [@eddywashere](https://forum.ghost.org/u/eddywashere)\
**Post date:** [July 24, 2025, 11:29pm UTC](https://forum.ghost.org/t/question-how-to-define-custom-location-block-e-g-ghost-via-traefik-instead-of-caddy/58996/3 "2025-07-24T23:29:54Z")

</div>

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

Also confirmed this works pointed to [ap.ghost.org](http://ap.ghost.org). To do this in coolify I added the following dynamic config to traefik proxy as a file named `activitypub.yaml`

```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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![jloh](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jloh/32/371_2.png) [@jloh](https://forum.ghost.org/u/jloh)\
**Post date:** [July 28, 2025, 3:04am UTC](https://forum.ghost.org/t/question-how-to-define-custom-location-block-e-g-ghost-via-traefik-instead-of-caddy/58996/4 "2025-07-28T03:04:47Z")

</div>

Nice! Glad you could get this working. Did you have any other issues getting Traefik going for AP?

I’m not sure we’ll officially support it at this stage but good to know its working.

---

<div class="post-metadata">

**Author:** ![eddywashere](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/eddywashere/32/33436_2.png) [@eddywashere](https://forum.ghost.org/u/eddywashere)\
**Post date:** [July 28, 2025, 12:06pm UTC](https://forum.ghost.org/t/question-how-to-define-custom-location-block-e-g-ghost-via-traefik-instead-of-caddy/58996/5 "2025-07-28T12:06:24Z")

</div>

No issues, so far so good 👍

---

<div class="post-metadata">

**Author:** ![ajfriesen](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/ajfriesen/32/15768_2.png) [@ajfriesen](https://forum.ghost.org/u/ajfriesen)\
**Post date:** [August 15, 2025, 8:34am UTC](https://forum.ghost.org/t/question-how-to-define-custom-location-block-e-g-ghost-via-traefik-instead-of-caddy/58996/6 "2025-08-15T08:34:57Z")

</div>

This is for the activity pub hosted by ghost right?

Do you know what needs to change when you also self-host the activity pub instance?

---

<div class="post-metadata">

**Author:** ![ajfriesen](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/ajfriesen/32/15768_2.png) [@ajfriesen](https://forum.ghost.org/u/ajfriesen)\
**Post date:** [August 19, 2025, 7:44am UTC](https://forum.ghost.org/t/question-how-to-define-custom-location-block-e-g-ghost-via-traefik-instead-of-caddy/58996/7 "2025-08-19T07:44:04Z")

</div>

Just found a blog post showing the traefik labels for the self hosted and ghost hosted activity pub version:

> **[Ghost 6 and ActivityPub behind Traefik on Docker](https://florianjensen.com/2025/08/06/ghost-6-activitypub-traefik-docker/)**
>
> How to set up ActivityPub when running Ghost 6 behind the Traefik reverse proxy on Docker.
