github.com/drud/ddev@v1.21.5-alpha1.0.20230226034409-94fcc4b94453/docs/content/users/extend/additional-hostnames.md (about)

     1  # Additional Project Hostnames
     2  
     3  Add additional hostnames to a project in its `.ddev/config.yaml`:
     4  
     5  ```
     6  name: mysite
     7  
     8  additional_hostnames:
     9  - "extraname"
    10  - "fr.mysite"
    11  - "es.mysite"
    12  - "it.mysite"
    13  - "*.lotsofnames"
    14  ```
    15  
    16  This configuration would result in working hostnames of `mysite.ddev.site`, `extraname.ddev.site`, `fr.mysite.ddev.site`, `es.mysite.ddev.site`, and `it.mysite.ddev.site`—with full HTTP and HTTPS URLs for each.
    17  
    18  In addition, the wildcard `*.lotsofnames` will result in anything `*.lotsofnames.ddev.site` being recognized by the project. This works only if you’re connected to the internet, using `ddev.site` for your top-level-domain, and using DNS for name lookups. (These are all the defaults.)
    19  
    20  **Although we recommend extreme care with this feature**, you can also provide `additional_fqdn` entries, which don't use the `.ddev.site` top-level domain. **This feature populates your hosts file with entries which may hide the real DNS entries on the internet, causing way too much head-scratching.**
    21  
    22  **If you use a FQDN which is resolvable on the internet, you must use `use_dns_when_possible: false` or configure that with `ddev config --use-dns-when-possible=false`.**
    23  
    24  ```
    25  name: somename
    26  
    27  additional_fqdns:
    28  - example.com
    29  - somesite.example.com
    30  - anothersite.example.com
    31  ```
    32  
    33  This configuration would result in working FQDNs of `somename.ddev.site`, `example.com`, `somesite.example.com`, and `anothersite.example.com`.
    34  
    35  !!!warning "Don’t use the same `additional_fqdns` or `additional_hostnames` in two different projects."
    36  
    37      If you see `ddev-router` status become unhealthy in [`ddev list`](../usage/commands.md#list), it’s most often a result of trying to use conflicting FQDNs in more than one project. `example.com` can only be assigned to one project, or it will break `ddev-router`.
    38  
    39  !!!warning "May not work predictably everywhere."
    40  
    41      This may not work predictably on all systems. There are operating systems and machines where `/etc/hosts` may not be the first or only resolution technique, especially if the `additional_fqdn` you use is also in DNS.
    42  
    43  !!!warning "Don’t override a real domain name!"
    44  
    45      If you use an `additional_fqdn` that exists on the internet (like `www.google.com`), your hosts file will override access to the original (internet) site, and you’ll be sad and confused that you can’t get to it.