fix: certificate.yml not discovered by Traefik file provider, breaks manually uploaded certs (#4707)#4711
Open
Mubashir-teapot wants to merge 1 commit into
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ymlinto 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 correctlywritten to disk and the
tls=truelabel is confirmed present on thecontainer.
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 ofcertificate.ymlwere always correct — only the file's location wasunreachable by Traefik's file provider.
Fix
Write
certificate.ymldirectly to the top-levelDYNAMIC_TRAEFIK_PATHinstead of the nested certificates subdirectory:
Before: /etc/dokploy/traefik/dynamic/certificates//certificate.yml
After: /etc/dokploy/traefik/dynamic/-certificate.yml
Since
watch: trueis enabled intraefik.yml, Traefik picks up thenew file instantly with no restart required. The actual PEM files
(
chain.crtandprivkey.key) remain unchanged in their originalsubdirectory — only the location of the pointer config file changes.
Testing
across two separate Docker Compose deployments
certificate (not the default cert) on all affected domains after fix
Error 526
Closes #4707