[英]Wildcard subdomain for some but not all values on DNSimple
I have an app that is roughly fractured between a server serving front end and one serving an API. 我有一个应用程序,它大致上是在服务于前端的服务器和服务于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
通过
https://example.com
和https://www.example.com
映射提供前端文件的服务器
Server for the API is mapped by https://api.example.com
API的服务器由
https://api.example.com
映射
We also have a forum, demo, etc at domains like https://forum.example.com
and https://demo.example.com
我们还在
https://forum.example.com
和https://demo.example.com
域上提供了一个论坛,演示等。
Right now this is all straightforward using ALIAS records in DNSimple. 现在,使用DNSimple中的ALIAS记录这一切都非常简单。
What is the best way to capture https://username.example.com
and map it to the front-end server? 捕获
https://username.example.com
并将其映射到前端服务器的最佳方法是什么? We will need it to be a wildcard eg *.example.com
, but we don't want to direct api
, forum
, demo
, etc to that server. 我们将其作为通配符,例如
*.example.com
,但我们不想将api
, forum
, demo
等直接定向到该服务器。
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? 有没有一种方法可以在DNS级别上设置层次结构或优先级,以便它首先检查命名的匹配项,然后在找不到任何内容的情况下转到通配符?
The way to go is exactly the one you considered. 走的路正好是您考虑过的路。 You should add a wildcard DNS record
您应该添加通配符DNS记录
*.example.com
that points to the IP (A) or hostname (CNAME) you want. 指向您想要的IP(A)或主机名(CNAME)。 The rule is that if there is a specific record matching the query, our DNS server will server it.
规则是,如果存在与查询匹配的特定记录,我们的DNS服务器将为其提供服务器。 Otherwise, we will fallback to the wildcard.
否则,我们将退回到通配符。
In other words, if you have a wildcard in place and a client asks for api.example.com
, we will serve the api
DNS record and not the wildcard. 换句话说,如果您有通配符,并且客户端要求
api.example.com
,我们将提供api
DNS记录,而不是通配符。 Specific records have higher priorities over wildcards. 特定记录的优先级高于通配符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.