Repository navigation
fix(traefik): copy all traefik certs from project to router, fixes #8100, replaces #8108 - #8113
Merged
Merged
Conversation
|
Download the artifacts for this pull request:
See Testing a PR. |
rfay
marked this pull request as ready for review
February 6, 2026 18:34
stasadev
approved these changes
Feb 6, 2026
stasadev
left a comment
Member
There was a problem hiding this comment.
In theory, users can have different certificates with the same name.
I can see this happening when someone has two projects. A cert expires, they update it in one project, and forget to update it in the other.
Anyway, it looks good to me.
…skip ci] - Fixes ddev#8100 Since DDEV v1.25.0, only certificates named exactly `<projectname>.crt` and `<projectname>.key` are copied from `.ddev/traefik/certs/` to the router. This prevents users from placing additional certificates (e.g., mTLS CA certs) in the project's traefik certs directory and having them available for use in custom Traefik configurations. Modified `PushGlobalTraefikConfig()` in `pkg/ddevapp/traefik.go` to: - Copy ALL `.crt` and `.key` files from `.ddev/traefik/certs/` instead of only the project-named files - Track all copied certificates in `expectedCerts` map so they won't be removed during cleanup - Add debug logging for each copied certificate This allows users to place any additional certificates (e.g., `ca.crt`, `client.crt`, etc.) in `.ddev/traefik/certs/` and reference them in custom Traefik configuration files. 1. Create a test project: `ddev config --project-type=php` 2. Create a custom certificate in `.ddev/traefik/certs/`, e.g., `.ddev/traefik/certs/custom-ca.crt` 3. Start the project: `ddev start` 4. Verify the cert is copied to the router: `docker exec ddev-router ls /mnt/ddev-global-cache/traefik/certs/` 5. Confirm `custom-ca.crt` appears in the list 6. Create a custom Traefik config that references the cert 7. Verify it's accessible in the router container - Existing `TestTraefikSimple` test passes - verifies basic cert handling - Existing `TestCustomGlobalConfig` test passes - verifies custom cert usage - No new tests added since existing integration tests cover the cert copying functionality This is a bug fix that restores functionality from pre-v1.25.0. Users who need to use additional certificates (e.g., for mTLS) in custom Traefik configurations can now place them in `.ddev/traefik/certs/` and they will be mounted into the router container. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
rfay
force-pushed
the
20260206_rfay_minimal_multiple_certs
branch
from
February 6, 2026 20:56
77908d0 to
b883070
Compare
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.
The Issue
Since DDEV v1.25.0, only certificates named exactly
<projectname>.crtand<projectname>.keyare copied from.ddev/traefik/certs/to the router. This prevents users from placing additional certificates (e.g., mTLS CA certs) in the project's traefik certs directory and having them available for use in custom Traefik configurations.NOTE
This is the first commit from #8108
Over there, I tried adding tests that seemed to create new complexities everywhere.
I'd like to see this simple fix succeed, probably with a simple test that simply verifies coverage on what it adds. Then the clear need for traefik custom config test coverage can be addressed separately.
How This PR Solves The Issue
Modified
PushGlobalTraefikConfig()inpkg/ddevapp/traefik.goto:.crtand.keyfiles from.ddev/traefik/certs/instead of only the project-named filesexpectedCertsmap so they won't be removed during cleanupThis allows users to place any additional certificates (e.g.,
ca.crt,client.crt, etc.) in.ddev/traefik/certs/and reference them in custom Traefik configuration files.Manual Testing Instructions
ddev config --project-type=php.ddev/traefik/certs/, e.g.,.ddev/traefik/certs/custom-ca.crtddev startdocker exec ddev-router ls /mnt/ddev-global-cache/traefik/certs/custom-ca.crtappears in the listAutomated Testing Overview
TestTraefikSimpletest passes - verifies basic cert handlingTestCustomGlobalConfigtest passes - verifies custom cert usageRelease/Deployment Notes
This is a bug fix that restores functionality from pre-v1.25.0. Users who need to use additional certificates (e.g., for mTLS) in custom Traefik configurations can now place them in
.ddev/traefik/certs/and they will be mounted into the router container.