Documentation Index
Fetch the complete documentation index at: https://mintlify.com/dokploy/dokploy/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Dokploy supports flexible HTTP redirect rules through Traefik middleware. Redirects allow you to route traffic based on regex patterns, enabling URL canonicalization, legacy path support, and complex routing scenarios.Understanding Redirects
Redirects in Dokploy use regex pattern matching to transform incoming URLs:- Regex: Pattern to match against the incoming request path
- Replacement: Target URL or path to redirect to
- Permanent: HTTP status code (301 vs 302)
Redirects are processed before the request reaches your application, making them efficient for handling URL transformations at the proxy level.
Creating Redirect Rules
Add redirect rule
Click Add Redirect and configure:
- Regex: Regular expression to match URLs
- Replacement: Target URL or path
- Permanent: Toggle for 301 (permanent) vs 302 (temporary)
Redirect Types
Permanent Redirects (301)
Use permanent redirects when URLs have moved permanently. Search engines will update their indexes.Temporary Redirects (302)
Use temporary redirects for maintenance pages, A/B testing, or when URLs might change back.Common Redirect Patterns
- Domain Redirect
- HTTPS Enforcement
- Path Normalization
- Subdirectory to Subdomain
Redirect from one domain to another:This preserves the path and query string while changing the domain.
Advanced Regex Patterns
Capture Groups
Use parentheses() to capture parts of the URL for reuse:
Multiple Captures
Optional Segments
Query String Handling
Preserve query strings in redirects:Multiple Redirects
Redirects are processed in order. The first matching rule wins.Rule Priority
Rule Priority
/special/page matches Rule 1 and stops.
Other /special/* paths match Rule 2.Chaining Redirects
Chaining Redirects
Bad: A → B → C (two hops)Good: A → C and B → C (direct redirects)
Use Cases
Legacy URL Support
Maintain old URLs when restructuring:
Locale Redirects
Route users to localized content:
API Versioning
Redirect deprecated API versions:
Marketing Campaigns
Vanity URLs for campaigns:
SEO Considerations
301 vs 302 Impact
- 301 Permanent
- 302 Temporary
Use when:
- Content moved permanently
- Domain migrations
- Site restructuring
- Passes 90-99% of link equity
- Search engines update index
- Cached by browsers
Best Practices
Testing Redirects
Command Line Testing
Expected Output
Test redirects in incognito/private mode to avoid browser caching issues.
Troubleshooting
Redirect Not Working
Redirect Not Working
Check:
- Regex pattern is valid and matches test URLs
- Redirect is saved and deployed
- Traefik configuration reloaded
- No conflicting redirect rules
Redirect Loop
Redirect Loop
Symptoms: Browser shows “Too many redirects” errorCause: Redirect targets another redirect, creating a cycleSolution:
Query Strings Lost
Query Strings Lost
Symptoms: Parameters disappear after redirectSolution: Explicitly capture query strings:
API Reference
Manage redirects programmatically:Regex Reference
Common regex patterns for redirects:| Pattern | Matches | Example |
|---|---|---|
^/path | Starts with /path | /path/to/page |
(.*)$ | Everything to end | Captures rest of URL |
\\d+ | One or more digits | 123, 2024 |
\\w+ | Word characters | abc, page_1 |
[^/]+ | Anything except / | segment |
\\?.* | Query string | ?id=123&sort=asc |
(a|b) | Either a or b | Matches a or b |