Does Dokploy support wildcard subdomains and custom domain routing? #2057
-
Hi, I have an application that allows users to configure custom subdomains (like user1.example.com) or custom domains (like userdomain.com) to access specific content in my app. My current plan is: The goal is for all these domains to route correctly to my app and serve the appropriate content based on the hostname. Is this setup supported in Dokploy? And is this a reasonable and feasible approach? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@cunpingtai afaik dokploy only uses Host rules not HostRegexp so i think you will have to add your own dynamic file http:
routers:
myapp-router:
entryPoints:
- web
- websecure
rule: "HostRegexp(`^([a-z0-9-]+)\\.example\\.com$`)"
service: myapp-service
tls: {}
services:
myapp-service:
loadBalancer:
servers:
- url: "http://myapp:3000" 'myapp' needs to match the service name in your compose, add any middleware or alter tls settings as required, this matches all subdomains on example.com |
Beta Was this translation helpful? Give feedback.
-
Dokploy is simply a wrapper over traefik, so the question would be traefik supports wildcard subdomains? the answer is yes, here in the traefik documentation it mentions the use of HostRegex https://doc.traefik.io/traefik/routing/routers/#host-and-hostregexp, so you would have to add it manually to your application configuration found in advanced section -> traefik configuration |
Beta Was this translation helpful? Give feedback.
@cunpingtai afaik dokploy only uses Host rules not HostRegexp so i think you will have to add your own dynamic file
'myapp' needs to match the service name in your compose, add any middleware or alter tls settings as required, this matches all subdomains on example.com