addPrefix + Ghost blog

Hello,

I am trying to setup a self-hosted Ghost blog system using docker + Traefik on https://ghost.labonnefabrique.fr. As Ghost will be used headless, I just need the admin part located at https://ghost.labonnefabrique.fr/ghost.

To simplify the navigation I would like to reroute ghost.labonnefabrique.fr/ to ghost.labonnefabrique.fr/ghost

I am setting up the traefik part with the following docker labels:

ghost:
    ...
    labels:
      - traefik.enable=true
      - traefik.http.routers.ghost.rule=Host(`ghost.labonnefabrique.fr`)
      - traefik.http.middlewares.add-ghost.addPrefix.prefix=/ghost
      - traefik.http.routers.ghost.middlewares=add-ghost
      - traefik.http.routers.ghost.entrypoints=websecure
      - traefik.http.routers.ghost.tls.certresolver=mydnschallenge

When reaching https://ghost.labonnefabrique.fr/, an error is returned
Server was unreachable

Looking to the console errors,

According to the Traefik dashboard, everythins is fine. What is wrong with my configuration?

I also tried

ghost:
    ...
    labels:
      - traefik.enable=true
      - traefik.http.routers.ghost.rule=Host(`ghost.labonnefabrique.fr`) && AddPrefix(`/ghost`)
      - traefik.http.routers.ghost.entrypoints=websecure
      - traefik.http.routers.ghost.tls.certresolver=mydnschallenge

but it's not working att all.

thanks,
Nicolas

TOO_MANY_REDIRECTS sounds like a redirect loop initiated by ghost. One reason for that is it's not programmed to handled mismatch between server and client url. On server, you add "/ghost" so this is what server see. javascript sees the same as your browser, so no "/ghost". If an application depends on these to be the same it will not work.

There is a whole topic about this stuff on their documentation, including redirect loops etc.

Thanks @zespri and @cakiwi. I'll check the doc. replacePath is maybe more suitable. Though as I will use the desktop application, this may not be a good idea to modify the way ghost works.

You didn't mention what is the server to handle the static site. Ghost is one piece of this puzzle.

@pascalandy
As the label is attached to the container the server is known. It is implicit.
However sometimes the server.port does need to be specified.

Hi,

Thanks for your returns, I appreciate. Ghost will be used headless, so the static site generator (11ty) will have to use the root address, and as I said, the desktop app also uses the root address. The rerouting may mess with that so I decided to not change the URL.

@pascalandy: the static site is hosted completely elsewhere (Netlify) and doesn't rely on Traefik... For now at least. Maybe in the future we'll also self-host the static site, but for now I benefit from the Netlify ease of use

Thanks