3

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
KemanoThief
  • 617
  • 8
  • 23

2 Answers2

3

This is a domain issue - The wrong value is sent in the 'host' request header.

The lexicographically first site is shown when this is the case. Disable this behaviour so that each site is only shown at the specified domain(s) and nothing is shown at mydomain.net.

To do this, add the following code inside the http section of /etc/nginx/nginx.conf and restart nginx

server {
  listen 80 default_server;
  listen [::]:80 default_server;

  server_name _;
  return 410;
  log_not_found off;
}

Source: http://dokku.viewdocs.io/dokku/configuration/domains/#default-site

KemanoThief
  • 617
  • 8
  • 23
2

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.

Jose Diaz-Gonzalez
  • 2,066
  • 1
  • 15
  • 19