mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
feat: do not append the global domain for matching subdomains
If the subdomain is url-like, assume it is a valid url and use it for the default domain name. This allows users to specify the default domain for an app even if that is a subdomain of a global vhost. Closes #3529
This commit is contained in:
@@ -27,21 +27,10 @@ scheme://subdomain.domain.tld
|
||||
|
||||
The `subdomain` is inferred from the pushed application name, while the `domain.tld` is set during initial dokku configuration. It can then be modified with `dokku domains:add-global` and `dokku domains:remove-global`. This value is used as a default TLD for all applications on a host.
|
||||
|
||||
If a FQDN such as `other.tld` is used as the application name, the global virtualhost will be ignored and the resulting vhost URL for that application will be `other.tld`. The exception to this rule being that if the FQDN has the same ending as the default vhost (such as `subdomain.domain.tld`), then the entire FQDN will be treated as a subdomain. The application will therefore be deployed at `subdomain.domain.tld.domain.tld`.
|
||||
If an FQDN such as `dokku.org` is used as the application name, the global virtualhost will be ignored and the resulting vhost URL for that application will be `dokku.org`.
|
||||
|
||||
You can optionally override this in a plugin by implementing the `nginx-hostname` plugin trigger. For example, you can reverse the subdomain with the following sample `nginx-hostname` plugin trigger:
|
||||
You can optionally override this in a plugin by implementing the `nginx-hostname` plugin trigger. If the `nginx-hostname` plugin has no output, the normal hostname algorithm will be executed. See the [plugin trigger documentation](/docs/development/plugin-triggers.md#nginx-hostname) for more information.
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1"; SUBDOMAIN="$2"; VHOST="$3"
|
||||
|
||||
NEW_SUBDOMAIN=`echo $SUBDOMAIN | rev`
|
||||
echo "$NEW_SUBDOMAIN.$VHOST"
|
||||
```
|
||||
|
||||
If the `nginx-hostname` plugin has no output, the normal hostname algorithm will be executed.
|
||||
|
||||
## Disabling VHOSTS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user