Skip to content

fix: certificate.yml not discovered by Traefik file provider, breaks manually uploaded certs (#4707)#4711

Open
Mubashir-teapot wants to merge 1 commit into
Dokploy:canaryfrom
Mubashir-teapot:fix/certificate-yml-traefik-file-provider-discovery
Open

fix: certificate.yml not discovered by Traefik file provider, breaks manually uploaded certs (#4707)#4711
Mubashir-teapot wants to merge 1 commit into
Dokploy:canaryfrom
Mubashir-teapot:fix/certificate-yml-traefik-file-provider-discovery

Conversation

@Mubashir-teapot

Copy link
Copy Markdown

Problem

Traefik's file provider is non-recursive — it only watches the top-level
/etc/dokploy/traefik/dynamic/ directory for configuration files.

Dokploy was writing certificate.yml into a nested subdirectory:
/etc/dokploy/traefik/dynamic/certificates//certificate.yml

Traefik never discovers files inside subdirectories, so it never loads
the certificate, never performs SNI matching, and always falls back to
TRAEFIK DEFAULT CERT — even when the certificate files are correctly
written to disk and the tls=true label is confirmed present on the
container.

This silently breaks HTTPS for anyone using manually uploaded
certificates (e.g. Cloudflare Origin CA) with Cloudflare Full (Strict)
mode, resulting in Error 526 at the origin.

Root Cause Verification

Confirmed via direct origin test, bypassing Cloudflare entirely:
Before fix:
$ openssl s_client -connect <ORIGIN_IP>:443 -servername | openssl x509 -noout -issuer
issuer=CN = TRAEFIK DEFAULT CERT
After fix:
issuer=C = US, O = "CloudFlare, Inc.", OU = CloudFlare Origin SSL Certificate Authority

The certificate files (chain.crt, privkey.key) and the contents of
certificate.yml were always correct — only the file's location was
unreachable by Traefik's file provider.

Fix

Write certificate.yml directly to the top-level DYNAMIC_TRAEFIK_PATH
instead of the nested certificates subdirectory:
Before: /etc/dokploy/traefik/dynamic/certificates//certificate.yml
After: /etc/dokploy/traefik/dynamic/-certificate.yml

Since watch: true is enabled in traefik.yml, Traefik picks up the
new file instantly with no restart required. The actual PEM files
(chain.crt and privkey.key) remain unchanged in their original
subdirectory — only the location of the pointer config file changes.

Testing

  • Verified on a live server with two certificates covering 5 domains
    across two separate Docker Compose deployments
  • Confirmed Traefik correctly served the uploaded Cloudflare Origin CA
    certificate (not the default cert) on all affected domains after fix
  • Confirmed Cloudflare Full (Strict) mode works end-to-end with no
    Error 526

Closes #4707

… Traefik file provider discovery

Traefik's file provider only watches the top-level
/etc/dokploy/traefik/dynamic/ directory, not subdirectories — every other
dynamic config (apps, middlewares) is already written flat at that level.

certificate.yml was instead written into the nested certificates/<id>/
subdirectory, so Traefik never discovered it and fell back to
TRAEFIK DEFAULT CERT, breaking HTTPS for manually uploaded certificates.

Move the pointer config to DYNAMIC_TRAEFIK_PATH (named after the unique
certificatePath, consistent with the ${appName}.yml convention used
elsewhere). The actual chain.crt/privkey.key stay in their subdirectory —
only the config file location changes. Also update removeCertificateById
to clean up the relocated file so deleted certificates don't leave a
dangling config pointing at removed key material.

Closes Dokploy#4707

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

1 participant