Skip to content

Service Name Duplication and Provider Mismatch in Standalone Traefik Setups #65

@xXAzazelXx

Description

@xXAzazelXx

Service Name Duplication and Provider Mismatch in Standalone Traefik Setups

Environment

  • Traefik Version: v3.5.2
  • MM Versions Tested:
    • traefik-int → latest
  • Setup: Standalone Traefik (no Pangolin) with ~100 file-based routes
  • Docker Compose: Standard standalone configuration

Issue Summary

Middleware Manager has issues when used with standalone Traefik setups that use file-based service definitions for external hosts.

Bug #1: Service Name Duplication (traefik-int tag)

MM recursively appends @file suffixes to service names on each config regeneration:

Progression:

  • Initial: service-name@file
  • 1st run: service-name@file@file
  • 2nd run: service-name@file@file@file@file

Traefik Logs:

ERR error="the service \"changedetection-xxxxxx@file@file\" does not exist"
ERR error="the service \"memos-xxxxx@file@file@file@file\" does not exist"

Bug #2: Provider Mismatch (latest tag)

The duplication bug is fixed, but MM now incorrectly assumes all services are Docker containers instead of file-defined external services.

My Working Configuration (production-routes.yml):

routers:
  xxx-xxxxx-auth:
    service: "xxx-xxxxx@file"    # Points to external service

services:
  xxx-xxxx@file:               # External host definition
    loadBalancer:
      servers:
        - url: "http://192.168.2.21:81"  # External IP

What MM Generates (resource-overrides.yml):

routers:
  xxx-xxxxx-auth-auth:
    service: "xxx-xxxxx@docker"  # Wrong! No such container exists

services:
  xxx-xxxxx@file:               # Correct service definition preserved
    loadBalancer:
      servers:
        - url: "http://192.168.2.21:81"

Result: Routers point to non-existent @docker services while the actual @file services exist.

Expected Behavior

For standalone setups, MM should preserve the original provider suffix (@file) when the services are defined in static files pointing to external hosts.

Reproduction Steps

  1. Setup standalone Traefik with file-based routes to external services
  2. Add MM with ACTIVE_DATA_SOURCE=traefik
  3. MM detects routes but generates @docker service references
  4. Traefik throws "service does not exist" errors

Configuration

middleware-manager:
  image: hhftechnology/middleware-manager:latest
  environment:
    - ACTIVE_DATA_SOURCE=traefik
    - TRAEFIK_API_URL=http://traefik:8080
    - TRAEFIK_CONF_DIR=/conf

Root Cause

MM's service detection logic appears to default to @docker provider for standalone setups, regardless of how the services are actually defined. For mixed environments (file-defined services + middleware management), MM should detect and preserve the original provider type.

Thanks for your effort on this project!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions