Skip to content

feat: allow customizing the subdomain template for preview deployments#4351

Open
ajnart wants to merge 3 commits intoDokploy:canaryfrom
ajnart:feat/custom-preview-template
Open

feat: allow customizing the subdomain template for preview deployments#4351
ajnart wants to merge 3 commits intoDokploy:canaryfrom
ajnart:feat/custom-preview-template

Conversation

@ajnart
Copy link
Copy Markdown
Contributor

@ajnart ajnart commented May 4, 2026

Summary

  • Add template variable interpolation (${prNumber}, ${branchName}, ${appName}, ${uniqueId}) to the preview wildcard domain field
  • Replace the "Wildcard Domain" UI with a "Preview Domain Template" field that shows available variables and a live example of the resulting URL
  • When ${prNumber} or ${branchName} is present, no random suffix is appended (these are already unique per PR)
  • Fully backward-compatible: existing *.traefik.me values work as before with no migration needed
Using PR number Overview
CleanShot 2026-05-04 at 16 21 58 image

Test plan

  • Unit tests added for interpolateSubdomainTemplate (9 tests covering variable replacement, slugification, DNS length truncation, special characters)
  • Existing traefik tests pass (14 tests, no regressions)
  • Manual testing: set template to ${prNumber}.previews.example.com, verify preview URL in PR comment
  • Manual testing: verify legacy *.traefik.me still works unchanged

Closes #4283

@ajnart ajnart requested a review from Siumauricio as a code owner May 4, 2026 14:21
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels May 4, 2026
ajnart added 2 commits May 4, 2026 16:23
…omains

Support ${prNumber}, ${branchName}, ${appName}, and ${uniqueId} variables
in the preview wildcard domain field. When ${prNumber} or ${branchName} is
present, no random suffix is appended since these already provide uniqueness.
Falls back to existing behavior when no template variables are used.

Closes Dokploy#4283
Replace the Wildcard Domain field with a Preview Domain Template field
that shows available template variables and a live example of the
resulting URL. Add unit tests for the interpolation logic covering
slugification, DNS length limits, and variable replacement.
@ajnart ajnart force-pushed the feat/custom-preview-template branch from afb3d97 to 26440e8 Compare May 4, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow customizing the subdomain template for Preview Deployments

1 participant