feat: add basic auth middleware UI under Traefik Dynamic#4285
Open
quochuydev wants to merge 3 commits intoDokploy:canaryfrom
Open
feat: add basic auth middleware UI under Traefik Dynamic#4285quochuydev wants to merge 3 commits intoDokploy:canaryfrom
quochuydev wants to merge 3 commits intoDokploy:canaryfrom
Conversation
Lets users create and delete Traefik basicAuth middlewares from the Traefik dashboard, so compose services can reference them as `<name>@file` via labels without hand-editing middlewares.yml.
- Show delete spinner only on the row being deleted (track deletingName
locally instead of sharing the mutation's isPending across all items).
- Handle null config from loadMiddlewares when middlewares.yml is empty
(yaml.parse('') returns null) — normalize before dereferencing in
create, and treat as NOT_FOUND in delete.
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.
Lets users create and delete Traefik basicAuth middlewares from the Traefik dashboard, so compose services can reference them as
<name>@filevia labels without hand-editing middlewares.yml.What is this PR about?
Adds a Basic Auth Middlewares card to the Traefik dashboard page (
/dashboard/traefik) that lets users create and delete TraefikbasicAuthmiddlewares directly inmiddlewares.ymlfrom the UI.Today, Applications can manage basic auth via Advanced → Security, but Compose apps (and anyone wanting a standalone basic auth middleware) have to SSH into the host and hand-edit YAML plus bcrypt hashes. This PR closes that gap with a generic, app-agnostic middleware manager.
The generated middleware is referenced manually as
<name>@file— either in compose labels or in a domain's Middlewares field — followed by a user-initiated redeploy. Traefik picks up the YAML change live.Checklist
Before submitting this PR, please make sure that:
canarybranch (feat/traefik-basic-auth-middleware-ui).Issues related (if applicable)
closes #4284
Screenshots (if applicable)
Greptile Summary
This PR adds a Basic Auth Middlewares UI to the Traefik dashboard, letting users create and delete
basicAuthentries inmiddlewares.ymlwithout hand-editing YAML. The approach is consistent with how the rest of the codebase manages Traefik dynamic config.loadMiddlewares()returnsnullfor an emptymiddlewares.yml(no exception is thrown, so thecatchis bypassed). BothcreateBasicAuthMiddlewareanddeleteBasicAuthMiddlewarethen dereference thatnullvalue without guarding against it, causing an unhandledTypeErroron the server.Confidence Score: 4/5
Safe to merge after fixing the null-config crash in the two new mutations.
One P1 defect: both mutating endpoints crash with a TypeError if middlewares.yml exists but is empty, because loadMiddlewares() returns null without throwing. The rest of the implementation follows existing codebase patterns and introduces no security regressions.
apps/dokploy/server/api/routers/settings.ts — null guard after loadMiddlewares() in both createBasicAuthMiddleware and deleteBasicAuthMiddleware
Reviews (1): Last reviewed commit: "[autofix.ci] apply automated fixes" | Re-trigger Greptile