Dokploy/dokploy

Add support for configuring Traefik middleware such as StripPrefix

Opened this issue · 2 comments

What problem will this feature address?

Currently, when deploying applications with URL prefixes using Dokploy, there's no built-in option to configure Traefik middlewares like StripPrefix. This limitation requires manual modifications to the Traefik configuration after deployment. It makes it difficult to deploy applications that need URL prefix handling without additional manual steps.

Describe the solution you'd like

I would like Dokploy to provide the ability to configure Traefik middlewares through its deployment configurations. Specifically, adding support for the StripPrefix middleware would allow users to specify prefixes that Traefik should strip from incoming requests before forwarding them to backend services.

Describe alternatives you've considered

The alternative is to manually modify the Traefik configuration after deployment to include the necessary middleware. For example:

http:
  routers:
    my-app-router:
      rule: Host(`myapp.example.com`) && PathPrefix(`/chat`)
      service: my-app-service
      middlewares:
        - strip-chat-prefix
      entryPoints:
        - web

  middlewares:
    strip-chat-prefix:
      stripPrefix:
        prefixes:
          - "/chat"

However, this manual process is not ideal for automated deployments and can lead to inconsistencies across environments.

Additional context

No response

Will you send a PR to implement it?

No

I have similar issues with middleware definitions for ipAllowList and basicAuth. Any attempt to apply these to routers via Docker labels doesn't work - they appear to be completely ignored. What is strange is that I can define them (via Docker labels) just fine (such as they appear in the Traefik console).

...
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.example-wordpress-test.rule=Host(`somehost.mycompany.co.uk`)"
      - "traefik.http.routers.example-wordpress-test.entrypoints=websecure"
      - "traefik.http.services.example-wordpress-test.loadbalancer.server.port=80"
      - "traefik.http.routers.example-wordpress-test.middlewares=MYauth@file" # Ignored, not applied
...

Got the same issue. Hope we can have traefik middleware supports