I have an app that is roughly fractured between a server serving front end and one serving an API. We'd like to add a wildcard to catch usernames on the subdomain and direct those to the front end server. So my URLs map like so:
Server that serves front-end files is mapped by https://example.com
and https://www.example.com
Server for the API is mapped by https://api.example.com
We also have a forum, demo, etc at domains like https://forum.example.com
and https://demo.example.com
Right now this is all straightforward using ALIAS records in DNSimple.
What is the best way to capture https://username.example.com
and map it to the front-end server? We will need it to be a wildcard e.g. *.example.com
, but we don't want to direct api
, forum
, demo
, etc to that server.
Is there a way to set hierarchies or priorities at the DNS level so that it checks for the named matches first and then moves on to wildcard if nothing is found?