Mattermost beginner: how to route subdomains

I’m trying to figure out how to use subdomains with mattermost. Since routing is done through react router which doesn’t handle subdomains, how can I accomplish using subdomains in my URLs and having them route correctly?