I'm facing a challenge with routing multiple domains in my production environment using Traefik. I'd like to share the problem and the solutions I've already tried, hoping to get additional insights from the community.
Current Situation:
I'm using Traefik as a reverse proxy in a Docker environment.
My application needs to accept requests from multiple domains, including users' custom domains.
The main domain works correctly.
When trying to access through other domains, I receive a 404 error.
What I've tried so far:
Modifying Traefik Labels:
I tried adjusting the labels in docker-compose.yml to accept any domain:
I checked Traefik and web service logs.
Confirmed that domains are correctly pointed to the server's IP.
Verified there are no port conflicts on the server.
Attempt to Use Dynamic Configuration:
I experimented with creating a dynamic_config.yml file for Traefik but faced difficulties in maintaining it after deploys.
Current Challenge:
The main obstacle I'm facing is that modifications made to the docker-compose.yml file in production are overwritten when I do a new deploy through Wappler. This makes it difficult to maintain custom Traefik configurations.
Questions for the Community:
Has anyone faced a similar challenge with multiple domain routing using Traefik in a Wappler environment?
Is there a recommended way to maintain custom Traefik configurations that aren't overwritten during deploys?
Is there any specific Wappler configuration that I might be overlooking that could solve this problem?
Any suggestions for a different approach that might be more effective in this scenario?
Thank you in advance for any guidance or suggestions. I'm open to providing additional information if needed.
This is the problem with Traefik and Wappler Docker deployments. Once you need anything slightly more advanced it becomes a nightmare.
I'm glad I caught this early on and stayed far away from anything related to it. If I were you I'd possibly look at Caddy server. This might be interesting:
I'd deploy Caddy using:
And then add Caddy labels to your Wappler Docker containers. Still a bit complicated, I know, but perhaps easier than dealing with Traefik.
Now how can I install Caddy and add labels to my container without it losing its settings after deployment?
So, the ideal would be for me to remove Traefik from my service and install Caddy or keep both services running?
Is there a step-by-step tutorial on how to make the Caddy work together with the Wappler or can I just follow the documentation from the links you mentioned and it will work?
Wappler won't override Caddy labels. It might override the wappler-proxy or caddy network but I guess you'll just have to keep an eye on it
I'm afraid there's no step-by-step tutorial for this. I know another Wappler with the same problem. And I lack the availability to provide decent assistance to this matter
I know Ken uses Caddy, probably a different approach (maybe simpler?), we'll see
Personally I'm using CloudPanel and PM2, but not sure if it's suitable to you due to custom domains
I really like Caddy and used it for a year or so. Then I decided to use Cloudflare for the bulk of certificate management along with everything else it provides. In doing so, I thought I would try to use Traefik and stay within the Wappler standards. In the end it didn’t turn out that way, but I had to move on to other things.
So today, I use an origin certificate and custom hostnames from Cloudflare and a custom setup of Traefik that handles a couple custom apex domain certificates that I couldn’t figure out with Cloudflare.
I’m sure in a few months I’ll come back and try to clean it up, but this stuff is not something I deal with every day, so it’s always a challenge.
And while I’m at it, I’ll probably try to add a load balancer into the mix…just to make myself go insane.
I just need users to add their domains, point them to DNS and then they can use their own domains. Do I have to lose all my brain cells to make this work?
Currently the automatic Traefik configuration in Wappler is based on a single domain. There are requests to add also a wildcard domain support. We hope to implement that soon.
You can indeed add your own Traefik labels but it can be quite challenging to get the right ones and specially if you need dynamic configurations with unknown domain names infront.
I would suggest to post a question about this on Traefik its own community and support forum:
Hi George, just wondering how this is progressing? Adding wildcard domain support is crucial for SaaS offering white label solutions. I need this function now but I am a bit lost. Do you have an ETA on this? Thanks