Get subdomain access url
Is there a var to get the generated subdomain access url? I need to add docker labels for traefik auto config.
It was mentioned it looks like this: <app>--<agent>--<workspace>--<username>.example.com
Solution:Jump to solution
Thanks, i just tried it without traefik auto config for workspaces, and it just worked 🤣
20 Replies
<#1385615313361567774>
Category
Help needed
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
hey! apologies for the delay, seems like your message went under our radar!
so you can't really do it this way but instead need to set up a wildcard subdomain with a wildcard certificate
see https://coder.com/docs/admin/setup#wildcard-access-url
Yep, i already have this running. I just thought there is maybe an easier way to get the generated wildcard access url. For now i just build it myself and pass it to traefik for autoconfig. Though it would be great to have a variable with the generated url.
is there a reason you're not just redirecting
*.coder.example.com
to traefik?
you don't need to know all the domains beforehand in this caseI do, though i need to let traefik know to which container the generated domains have to be redirected to.
Like this:

It works by manually building the url like this:
<app>--<agent>--<workspace>--<username>.example.com
Though it would be more convenient to just read them from a app var like coder_app.webui.generated_url
Traefik gets the config directly from docker: https://doc.traefik.io/traefik/providers/docker/
Traefik Docker Documentation - Traefik
Learn how to achieve configuration discovery in Traefik through Docker. Read the technical documentation.
All i need to add is some labels to the
docker_config
.that is not needed though, if you route it all through the Coder control plane it'll act as a reverse-proxy
are there any constraints in your setup preventing you to do it this way?
Nope, just thought that is necessary for correct routing like all my other containers. Will try the coder way next 🙂
sounds good, let me know if you run into any trouble
another quick question, is there anything in particular in our docs that led you to believe this?
asking so we can correct our wording
I just assumed this while transferring some docker compose files i wanted to try out. All of my compose files are using docker labels for traefik auto config.
Maybe you can visualize the data flow in "Setup -> Reverse Proxy" using a rev proxy, coder and some workspaces.
I just checked other pages in the docs and the image in "Architecture" can be misleading regarding this topic. The Desktop IDEs are pointing to the workspaces directly.

thx!
I went through a bunch of hoops getting this to work last week, add tailscale into the mix and SSL and it got fun. If there's anything I can do to help @daschatten just let me know, happy to share as it 's all working now
Solution
Thanks, i just tried it without traefik auto config for workspaces, and it just worked 🤣
thanks for the follow-up! i'll keep this in mind to see if we can make the docs better!
@Phorcys closed the thread.