DNS 文件映射

发布于 2024-08-09 04:43:51 字数 333 浏览 3 评论 0原文

我正在尝试开发一个 Web 应用程序的功能,但此时我有点困惑。我想知道是否有人可以阐明以下场景。

假设我的 Web 应用程序位于 domain1.com,用户网站位于 domain2.com。我希望允许用户能够将其域映射到我的服务器上的文件/页面之一。因此,如果有人访问domain2.com/files,那么它将在内部透明地路由到domain1.com/files.aspx?domain=2(注意域参数)。

我知道这可以通过用户服务器上的简单文件重定向(301 或 302)来完成,但我想在 DNS 级别上实现这一点。我该怎么办呢?

提前致谢!

I'm trying to work out a feature for a Web application, but I'm a bit confused at this point. I was wondering if anyone can shed some light on the following scenario.

Say, my Web app is located at domain1.com and a users website is located at domain2.com. What I would like to allow is for the user to be able to map their domain to one of the files/pages on my server. So if someone accesses domain2.com/files then it will internally and transparently route to domain1.com/files.aspx?domain=2 (notice the domain parameter).

I know this can be done with a simple file redirection (301 or 302) on the users server, but I would like to achieve this on the DNS level. How can I go about it?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不喜欢何必死缠烂打 2024-08-16 04:43:51

您可以使用 A 记录将domain2.com(或子域)映射到运行domain1.com 的同一IP。这就是您在 DNS 级别上可以实现的所有内容,因为它不关心目录结构。

You can map domain2.com (or a subdomain) to the same IP domain1.com runs on using the A record. That's about everything you can achieve on DNS level, as it doesn't care about directory structures.

没有心的人 2024-08-16 04:43:51

简而言之,你不能。如果您想将 foo.domain1.com 指向 foo.domain2.com 的记录,那么您可以使用 CNAME 记录,但 DNS 不知道 HTTP URL。

Simply put, you can't. If you wanted to point foo.domain1.com to the record for foo.domain2.com, then you can probably use a CNAME record but DNS has no clue about HTTP URLs.

〆凄凉。 2024-08-16 04:43:51

如果您将 Simple DNS Plus 的“HTTP 重定向器”插件配置为重定向到“http://domain1.com/files.aspx?domain=#HOST#"

从技术上讲,它实际上执行 HTTP 重定向(本地 DNS 是不可能的),但它是在 DNS 服务器上完成的,而不是在 DNS 服务器上完成的。网络服务器。

请参阅http://www.simpledns.com/kb.aspx?kbid=1258

The "HTTP Redirector" plug-in for Simple DNS Plus does just that if you configure it to redirect to "http://domain1.com/files.aspx?domain=#HOST#"

Technically it actually does a HTTP redirect (native DNS is not possible), but it is done at the DNS servers instead of the web-server.

See http://www.simpledns.com/kb.aspx?kbid=1258

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文