Simple Rule Not Working - 404 Not Found

Hi,

Sorry if this is a really basic question but I've been pulling my hair out for two days over this to get a simple example working beyond the local docker demo.

For the sake of simplicity, let's say I've got just a server running where I'm going to run traefik and then a single server where I'm going to run my service. If I go to the IP address of the service on port 8501 it serves a simple dashboard. Eventually, I'll want this behind a domain name but for now, I'm just trying to get it to work without that.

  • traefik server - 192.168.1.10
  • service - 192.168.1.20:8501

I'm trying to get it working so that if I go to 192.168.1.10/demo_dashboard I'll see the dashboard I get if I go to 192.168.1.20:8501. I've tried lots of tweaks on the rules but keep getting 404: Not Found no matter what I do. I think I'm missing something really basic but have looked all around the documentation.

Here's my basic config file:

api:
  dashboard: true
  insecure: true
entryPoints:
  web:
    address: ":80"
    forwardedHeaders:
      insecure: true
    proxyProtocol:
      insecure: true
providers:
  file:
    directory: "/etc/traefik_config"

Then I have a routers.yaml file in traefik_config:

http:
  routers:
    my-router:
      entryPoints:
        - "web"
      rule: "PathPrefix(`/demo_dashboard`)"
      service: demo_dashboard
  services:
    demo_dashboard:
      loadBalancer:
        servers:
          - url: "http://192.168.1.20:8501"

For the rule for my-router I've also tried including Host(192.168.1.10) but that doesn't seem to do anything. No matter what I try I seem to get 404 pages. Again, I'm sure it's really basic but any tips would be greatly appreciated. Thanks!

I can't say I see anything out of order.

How are you invoking traefik?
You could also turn the logging up to debug and see if anything looks odd.

1 Like

Thanks for taking a look. I ended up having to include a middleware rule to strip the prefix '/demo_dashboard'. It seems to work okay but it feels very verbose. Thanks again!

Right. That make sense then.

And that is how you do it :slight_smile:

Thanks for following up with how you got it working.

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