File watch not working for subdirectories

Hello,

I am facing an issue where Traefik does not seem to reload the configuration after making changes.

I have organized my configuration files as follows:

/traefik/configurations/
├── routers/
│   ├── domain1.yml
│   ├── domain2.yml
├── middlewares/
│   └── middleware1.yml
├── services/
│   └── service1.yml

In the config.yml file, the provider is configured as follows:

providers:
  file:
    directory: "/home/debian/traefik/configurations"
    watch: true

However, when I modify the domain1.yml file, the configuration doesn't seem to reload automatically. I have to restart Traefik for the changes to take effect.

On the other hand, I noticed that if I configure the provider like this, it works, but only for the files in the routers folder, and not for middlewares or services:

providers:
  file:
    directory: "/home/debian/traefik/configurations/routers"
    watch: true

If anyone could help me resolve this issue, it would be greatly appreciated.

Thank you in advance!

It seems folders in the folder are not watched.

So either you place all files inside the config folder directly, or you create 3 providers.file watching the 3 folders.

I was able to do some research, and indeed, this is not supported by Traefik. I am quite surprised, as this feature seems essential for working effectively with a reverse proxy in dynamic mode.

The best solution I’ve found so far is to place the dynamic files at the root of the directory and keep the more static configurations in separate folders.

/configurations
├── /middlewares
├── middlewareIP
├── middlewareWhiteList
├── /routers
├── security1
├── security2
domain1
domain2
domain3

But it remains disastrous between the concept of dynamic configuration (for IPs, for example) and the notion of organization within the teams.

Over the years only very few people asked for this, so it seems like a niche topic, on which the devs usually don't place high priority on.

You are probably using Traefik as free community edition, the great thing is it's open-source, so you could (let someone) implement the feature and create a pull request.