Search code examples
nginxdnsvhostsdokku

Dokku subdomains all point to a single app


I've got multiple apps hosted on one server using Dokku. I've got vhosts subdomains enabled in Dokku so I want to acess my apps at:

  • app1.mydomain.net
  • app2.mydomain.net

...but when I point my browser to...

  • app1.mydomain.net
  • randomtext.mydomain.net
  • mydomain.net

...I always get app2.

Any ideas how I can access app1 at app1.mydomain.net? Can I also disable anything being shown at mydomain.net? I thought this was default behaviour so I'd like to know what I've set up wrong.

More details:

I'm on Dokku 0.5.6, running on a DigitalOcean droplet.

When I run dokku domains app1 I get:

=====> Global Domain Name
mydomain.net
=====> app1 Domain Names
app1.mydomain.net

...and when I run dokku domains app2 I get:

=====> Global Domain Name
mydomain.net
=====> app2 Domain Names
app2.mydomain.net

Solution

  • Can you copy the output of the following commands?

    dokku domains app1
    dokku domains app2
    

    It is possible you added app1.mydomain.net to app2, removed it from app1 or that app1 isn't actually deployed.

    Unknown HOST headers are routed to the lexicographically first site in the nginx config stack. Some information about that is available here.

    More information about dokku's domain management is available here.