Traefik with URL instead of subdomain proxying not working

I'm trying to launch a super simple dashboard with traefik. However, it's weirdly hit and miss - meaning I run docker-compose up with the identical file and everything and sometimes it works as intended but it often just returns a blank screen - no error so the routing worked but it's not actually calling the dashboard. It's really frustrating and I can't figure it out.

Here's my docker-compose:

services:
  traefik:
    image: traefik
    container_name: traefik
    command:
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--accesslog=true"
      - "--log.level=INFO"
    ports:
      - 80:80
      - 8080:8080
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    restart: unless-stopped

  homer:
    image: b4bz/homer
    container_name: homer_dashboard
    volumes:
      - ./data-homer/:/www/assets
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.homer.rule=HostHeader(`192.168.1.135`)"
      - "traefik.http.routers.homer.rule=Path(`/homer`)"
      - "traefik.http.middlewares.homer-strip.stripprefix.prefixes=/homer"
      - "traefik.http.routers.homer.middlewares=homer-strip@docker"
      - "traefik.http.routers.homer.entrypoints=web"
    restart: unless-stopped

P.S. I'm doing this because I just want a simple domain-name-less solution on my LAN. If there's a better way feel free to let me know.

Hello, the labels are stored in a map, so you cannot the twice the same key (ex: traefik.http.routers.homer.rule)

If you want to use 2 rules:

      - "traefik.http.routers.homer.rule=Host(`192.168.1.135`) && Path(`/homer`)"

But in your case I think you just need one:

      - "traefik.http.routers.homer.rule=Path(`/homer`)"

Thanks for the help Idez,

I commented out the host part of the router, so my labels for the homer dashboard now looks like:

      - "traefik.enable=true"
      - "traefik.http.routers.homer.rule=Path(`/homer`)"
      - "traefik.http.middlewares.homer-strip.stripprefix.prefixes=/homer"
      - "traefik.http.routers.homer.middlewares=homer-strip@docker"
      - "traefik.http.routers.homer.entrypoints=web"

However, when I'm running this I still get the bug I mentioned before where when I visit "192.168.1.135/homer" nothing loads. Here's the access logs when I visit that URL:

homer_dashboard | 1599331097 172.25.0.2 "GET /" 304 136 "" "Mozilla/5.0 (X11; Linux x86_64; rv:79.0) Gecko/20100101 Firefox/79.0"
traefik    | 192.168.1.241 - - [05/Sep/2020:18:38:17 +0000] "GET /homer HTTP/1.1" 304 0 "-" "-" 12 "homer@docker" "http://172.25.0.3:8080" 1ms
traefik    | 192.168.1.241 - - [05/Sep/2020:18:38:17 +0000] "GET /css/chunk-vendors.5ff60f72.css HTTP/1.1" 404 19 "-" "-" 13 "-" "-" 0ms
traefik    | 192.168.1.241 - - [05/Sep/2020:18:38:17 +0000] "GET /css/app.c2005593.css HTTP/1.1" 404 19 "-" "-" 14 "-" "-" 0ms
traefik    | 192.168.1.241 - - [05/Sep/2020:18:38:17 +0000] "GET /js/chunk-vendors.154bfb0d.js HTTP/1.1" 404 19 "-" "-" 15 "-" "-" 0ms
traefik    | 192.168.1.241 - - [05/Sep/2020:18:38:17 +0000] "GET /js/app.2b7282d6.js HTTP/1.1" 404 19 "-" "-" 16 "-" "-" 0ms

This may be a homer issue but this persists across multiple different docker apps so I'd really doubt it.

Thanks again

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.