GoDoxy
Advanced Topics

Domain Matching

Configure domain matching for GoDoxy

An alias can be:

  • a short alias like app
  • an FQDN (Fully Qualified Domain Name) alias like app.example.com
  • a leading-label wildcard alias like *.example.com

Docker

By default, the container name is used as the short alias unless proxy.aliases is set.

General

Without match_domains

If match_domains is not set in config.yml, below will match route with short alias app:

  • app.anydomain.com
  • app.*.anydomain.com
  • ...

Below will match route with FQDN alias app.example.com:

  • app.example.com
  • app.example.com.*

Below will match route with wildcard alias *.example.com:

  • foo.example.com
  • bar.example.com

And will not match:

  • example.com
  • foo.bar.example.com

Using match_domains

Use this to restrict which base domains are valid.

With match_domains in config.yml:

match_domains:
  - example.com
  - example.org

Then a short alias app can be accessed only at:

  • app.example.com
  • app.example.org

And a route with FQDN alias app.example.com can be accessed at:

  • app.example.com

And a wildcard alias *.example.com can be accessed only at one-label subdomains such as:

  • foo.example.com
  • bar.example.com

but not:

  • foo.bar.example.com

Priority

Host resolution order is:

  1. existing exact/FQDN or short-alias domain match
  2. wildcard alias fallback

This keeps normal exact-route matching fast while still allowing wildcard aliases.

Route file example

Quote wildcard aliases in YAML route files:

"*.example.com":
  host: 10.0.0.20
  port: 8080

Use case example for match_domains

Given your main domain is my.app:

  • Add my.app to autocert.domains and match_domains in config.yml.

    autocert:
      domains:
        - my.app
    match_domains:
      - my.app
  • Use short aliases like adguard and sonarr when you want them accessible under your main domain.

    services:
      adguard: # adguard.my.app
        ...
        labels:
          proxy.aliases: adguard
      sonarr: # sonarr.my.app
        ...
        labels:
          proxy.aliases: sonarr
  • Use FQDN aliases like adguard.other.app and sonarr.other.app when you want them accessible under other domains.

    # docker compose
    services:
      adguard:
        ...
        labels:
          proxy.aliases: adguard.other.app
      sonarr:
        ...
        labels:
          proxy.aliases: sonarr.other.app
    
    # config.yml
    autocert:
      domains:
        - my.app

On this page