this post was submitted on 13 Sep 2024
6 points (87.5% liked)

homelab

6635 readers
30 users here now

founded 4 years ago
MODERATORS
 

cross-posted from: https://lemmy.blahaj.zone/post/16452222

Hello friends, I've been pulling my hair out trying to figure out how to get my service to properly play well with traefik.

My service is reachable at /dnd-notes/page, but the service needs to fetch additional resources and fails to do so.

IE: user navigates to /dnd-notes/foobar

foobar loads. foobar fetches /.client/main.css foobar fails to find this resource.

Here is my static configuration:

## traefik-static.yml
providers:
  docker:     
    exposedByDefault: false
    
api:
  insecure: true
  dashboard: true

entryPoints: 
  web:
    address: :80
  websecure:  
    address: :443
    
log:
  level: DEBUG

Here is my compose:

services:
  traefik:
    image: "traefik:latest"
    container_name: "traefik"
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./traefik/traefik.yaml:/etc/traefik/traefik.yaml"

  silverbullet:
    image: zefhemel/silverbullet
    container_name: "dnd-notes"
    volumes:
      - './dnd-notes/space:/space'
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.dndnotes.rule=PathPrefix(`/dnd-notes/`)"
      - "traefik.http.routers.dndnotes.service=dndnotes"
      - "traefik.http.routers.dndnotes.entrypoints=web"
      - "traefik.http.routers.dndnotes.middlewares=dndnotes_stripprefix"
      - "traefik.http.services.dndnotes.loadbalancer.server.port=3000"
      - "traefik.http.middlewares.dndnotes_stripprefix.stripprefix.prefixes=/dnd-notes"
you are viewing a single comment's thread
view the rest of the comments
[–] worldofbirths@lemmy.world 4 points 2 months ago (2 children)

Unfortunately this is not a Traefik issue but a Silverbullet issue. Essentially, the web server doesn't support a subpath and instead assumes that it is at the root - see https://github.com/silverbulletmd/silverbullet/issues/794 for details.

You can try hosting it from a different subdomain or port instead.

[–] zamithal@lemmy.blahaj.zone 1 points 2 months ago (1 children)

Thank you, it probably would have taken me a while to figure that out.

To use subdomains on my internal network, I will need my own dns service correct?

. will not resolve and neither will .

I could use a different port, but then I'm not really using the reverse proxy

[–] worldofbirths@lemmy.world 0 points 2 months ago

You need a domain name that will resolve to the IP address of the machine running the server. It doesn't need to be your own DNS server. If you already have a domain name, you can just add an A record that points to the IP in your local network.